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

Function main

contents/cooley_tukey/code/rust/fft.rs:94–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92}
93
94fn main() {
95 let mut x = Vec::with_capacity(64);
96 let mut rng = thread_rng();
97 for _i in 0..64 {
98 let real = rng.gen_range(0.0_f64, 1.0_f64);
99 x.push(Complex::new(real, 0.0_f64));
100 }
101 let v = fft(&x);
102 let y = cooley_tukey(&x);
103 let z = iterative_cooley_tukey(&x);
104 let t = dft(&x);
105
106 println!(
107 "{}",
108 v.iter().zip(y.iter()).all(|i| (i.0 - i.1).norm() < 1.0)
109 );
110 println!(
111 "{}",
112 v.iter().zip(z.iter()).all(|i| (i.0 - i.1).norm() < 1.0)
113 );
114 println!(
115 "{}",
116 v.iter()
117 .zip(t.into_iter())
118 .all(|i| (i.0 - i.1).norm() < 1.0)
119 );
120}

Callers

nothing calls this directly

Calls 5

fftFunction · 0.70
cooley_tukeyFunction · 0.70
iterative_cooley_tukeyFunction · 0.70
dftFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected