pub trait TimeToFrequencyDomainOperations<S, T>: ToFreqResultwhere
    S: ToSliceMut<T>,
    T: RealNumber,
{ fn plain_fft<B>(self, buffer: &mut B) -> Self::FreqResult
    where
        B: for<'a> Buffer<'a, S, T>
; fn fft<B>(self, buffer: &mut B) -> Self::FreqResult
    where
        B: for<'a> Buffer<'a, S, T>
; fn windowed_fft<B>(
        self,
        buffer: &mut B,
        window: &dyn WindowFunction<T>
    ) -> Self::FreqResult
    where
        B: for<'a> Buffer<'a, S, T>
; }
Expand description

Defines all operations which are valid on DataVecs containing time domain data.

Failures

All operations in this trait set self.len() to 0 if the vector isn’t in time domain.

Required Methods

Performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector.

This version of the FFT neither applies a window nor does it scale the vector.

Example
use std::f32;
use basic_dsp_vector::*;
let vector = vec!(Complex::new(1.0, 0.0), Complex::new(-0.5, 0.8660254), Complex::new(-0.5, -0.8660254)).to_complex_time_vec();
let mut buffer = SingleBuffer::new();
let result = vector.plain_fft(&mut buffer);
let actual = &result[..];
let expected = &[Complex::new(0.0, 0.0), Complex::new(3.0, 0.0), Complex::new(0.0, 0.0)];
assert_eq!(actual.len(), expected.len());
for i in 0..actual.len() {
       assert!((actual[i] - expected[i]).norm() < 1e-4);
}

Performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector.

Example
use std::f32;
use basic_dsp_vector::*;
let vector = vec!(Complex::new(1.0, 0.0), Complex::new(-0.5, 0.8660254), Complex::new(-0.5, -0.8660254)).to_complex_time_vec();
let mut buffer = SingleBuffer::new();
let result = vector.fft(&mut buffer);
let actual = &result[..];
let expected = &[Complex::new(0.0, 0.0), Complex::new(0.0, 0.0), Complex::new(3.0, 0.0)];
assert_eq!(actual.len(), expected.len());
for i in 0..actual.len() {
       assert!((actual[i] - expected[i]).norm() < 1e-4);
}

Applies a FFT window and performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector.

Implementors