MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / dft

Function dft

contents/cooley_tukey/code/rust/fft.rs:24–37  ·  view source on GitHub ↗
(x: &[Complex<f64>])

Source from the content-addressed store, hash-verified

22}
23
24fn 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
39fn cooley_tukey(x: &[Complex<f64>]) -> Vec<Complex<f64>> {
40 let n = x.len();

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected