(x: &[Complex<f64>])
| 22 | } |
| 23 | |
| 24 | fn dft(x: &[Complex<f64>]) -> Vec<Complex<f64>> { |
| 25 | let n = x.len(); |
| 26 | (0..n) |
| 27 | .map(|i| { |
| 28 | (0..n) |
| 29 | .map(|k| { |
| 30 | x[k] * (Complex::new(0.0_f64, -2.0_f64) * PI * (i as f64) * (k as f64) |
| 31 | / (n as f64)) |
| 32 | .exp() |
| 33 | }) |
| 34 | .sum() |
| 35 | }) |
| 36 | .collect() |
| 37 | } |
| 38 | |
| 39 | fn cooley_tukey(x: &[Complex<f64>]) -> Vec<Complex<f64>> { |
| 40 | let n = x.len(); |