Skip to main content

FFTEnhanced

Struct FFTEnhanced 

Source
pub struct FFTEnhanced;
Expand description

Enhanced Fast Fourier Transform (FFT) implementation supporting arbitrary-sized inputs

This module extends the FFT functionality to support:

  1. Non-power-of-2 input sizes
  2. Additional window functions
  3. Optimized implementation for real-valued inputs
  4. Implementation of the Stockwell transform (S-transform)

FFTEnhanced provides extended FFT functionality

Implementations§

Source§

impl FFTEnhanced

Source

pub fn fft_any_size<T>(x: &Array<T>) -> Result<Array<Complex<T>>>
where T: Float + Clone + Debug + Into<f64> + From<f64>,

Compute the FFT of an array with any size (not limited to powers of 2)

This function implements the Chirp-Z transform to handle arbitrary sizes

§Parameters
  • x - The input array
§Returns
  • The FFT of the input array
Source

pub fn ifft_any_size<T>(x: &Array<Complex<T>>) -> Result<Array<Complex<T>>>
where T: Float + Clone + Debug + Into<f64> + From<f64>,

Compute the inverse FFT of a complex array with any size

§Parameters
  • x - The input complex array
§Returns
  • The inverse FFT of the input array
Source

pub fn window<T>(window_type: &str, n: usize) -> Result<Array<T>>
where T: Float + Clone + Debug + From<f64>,

Generate a window function with any size

§Parameters
  • window_type - The type of window function
  • n - The size of the window
§Returns
  • The window function as an array
Source

pub fn apply_window<T>(x: &Array<T>, window_type: &str) -> Result<Array<T>>
where T: Float + Clone + Debug + From<f64>,

Apply a window function to a signal

§Parameters
  • x - The input signal
  • window_type - The type of window function
§Returns
  • The windowed signal
Source

pub fn window_energy_concentration<T>( window_types: &[&str], n: usize, ) -> Result<Vec<(String, T)>>
where T: Float + Clone + Debug + From<f64> + Into<f64>,

Calculate the energy concentration of different window functions in frequency domain

§Parameters
  • window_types - List of window function types to compare
  • n - The size of the window
§Returns
  • A map of window type to its energy concentration in dB
Source

pub fn stockwell_transform<T>( x: &Array<T>, min_freq: Option<usize>, max_freq: Option<usize>, ) -> Result<Array<Complex<T>>>
where T: Float + Clone + Debug + Into<f64> + From<f64>,

Compute the Stockwell Transform (S-Transform) of a signal

The S-transform is a time-frequency spectral localization method similar to the short-time Fourier transform, but with a Gaussian window whose width scales with frequency.

§Parameters
  • x - The input signal
  • min_freq - Minimum frequency index to compute (optional)
  • max_freq - Maximum frequency index to compute (optional)
§Returns
  • The S-transform of the input signal (2D array)
Source

pub fn real_fft_optimized<T>(x: &Array<T>) -> Result<Array<Complex<T>>>
where T: Float + Clone + Debug + Into<f64> + From<f64>,

Optimized FFT for real-valued inputs (Hermitian optimized FFT)

This implementation takes advantage of the conjugate symmetry of the FFT of real-valued signals. For now, it uses the standard FFT approach to ensure correctness, with potential optimizations to be added later.

§Parameters
  • x - The real-valued input array
§Returns
  • The FFT of the input array

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V