Skip to main content

fft

Function fft 

Source
pub fn fft(input: &[Complex]) -> Vec<Complex>
Expand description

Radix-2 Cooley–Tukey FFT of input.

The length must be a power of two; otherwise this panics.

use mathverse_complex::{fft::fft, Complex};
let x = vec![Complex::new(1.0, 0.0), Complex::new(2.0, 0.0)];
let y = fft(&x);
assert_eq!(y.len(), 2);
assert!((y[0].re - 3.0).abs() < 1e-12);
assert!((y[1].re + 1.0).abs() < 1e-12);