pub fn fft<T>(input: &[T], n: Option<usize>) -> FFTResult<Vec<Complex64>>
Expand description
Compute the 1-dimensional Fast Fourier Transform
§Arguments
input
- Input data arrayn
- Length of the output (optional)
§Returns
A vector of complex values representing the FFT result
§Examples
use scirs2_fft::fft;
use scirs2_core::numeric::Complex64;
// Generate a simple signal
let signal = vec![1.0, 2.0, 3.0, 4.0];
// Compute the FFT
let spectrum = fft(&signal, None).unwrap();
// The DC component should be the sum of the input
assert!((spectrum[0].re - 10.0).abs() < 1e-10);
assert!(spectrum[0].im.abs() < 1e-10);