(x: &[Complex<f64>])
| 9 | // This is based on the Python and C implementations. |
| 10 | |
| 11 | fn fft(x: &[Complex<f64>]) -> Vec<Complex<f64>> { |
| 12 | let n = x.len(); |
| 13 | let mut new_x = x.to_vec(); |
| 14 | let mut y = vec![Complex::new(0.0_f64, 0.0_f64); n]; |
| 15 | |
| 16 | let mut planner = FFTplanner::new(false); |
| 17 | let this_fft = planner.plan_fft(n); |
| 18 | this_fft.process(new_x.as_mut_slice(), y.as_mut_slice()); |
| 19 | |
| 20 | // y.into_iter().map(|i| i / (n as f64).sqrt()).collect() |
| 21 | y |
| 22 | } |
| 23 | |
| 24 | fn dft(x: &[Complex<f64>]) -> Vec<Complex<f64>> { |
| 25 | let n = x.len(); |