pub struct FourierSeries;Expand description
Discrete Fourier Transform and spectral utilities.
Provides Cooley-Tukey radix-2 FFT (in-place), IFFT, power spectrum estimation, and circular convolution via the convolution theorem.
Implementations§
Source§impl FourierSeries
impl FourierSeries
Sourcepub fn fft(data: &[f64]) -> Vec<(f64, f64)>
pub fn fft(data: &[f64]) -> Vec<(f64, f64)>
Compute the FFT of data (length must be a power of 2).
Returns a vector of complex coefficients X[k] where
X[k] = Σ x[n] * exp(-2πi kn/N).
Sourcepub fn ifft(spectrum: &[(f64, f64)]) -> Vec<f64>
pub fn ifft(spectrum: &[(f64, f64)]) -> Vec<f64>
Compute the inverse FFT.
Input is a slice of (re, im) pairs; output is the real part of the
inverse transform (discards imaginary part which should be ~0 for real signals).
Sourcepub fn power_spectrum(data: &[f64]) -> Vec<f64>
pub fn power_spectrum(data: &[f64]) -> Vec<f64>
Compute the one-sided power spectrum of data.
Returns |X[k]|^2 / N for k = 0, …, N/2.
Sourcepub fn convolve(a: &[f64], b: &[f64]) -> Vec<f64>
pub fn convolve(a: &[f64], b: &[f64]) -> Vec<f64>
Circular convolution of a and b via the convolution theorem.
Both inputs must have the same length (a power of 2).
Returns the circular convolution a * b.
Auto Trait Implementations§
impl Freeze for FourierSeries
impl RefUnwindSafe for FourierSeries
impl Send for FourierSeries
impl Sync for FourierSeries
impl Unpin for FourierSeries
impl UnsafeUnpin for FourierSeries
impl UnwindSafe for FourierSeries
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.