blob: ee8c72f301702fa84839cf153acc67ec50c8f8ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use realfft::{RealFftPlanner, FftNum, RealToComplex};
fn main() {
let mut planner: RealFftPlanner<f32> = RealFftPlanner::new();
//let rfft = planner.plan_fft_forward(4);
let rfft = planner.plan_fft_forward(40);
let mut scratch = rfft.make_scratch_vec();
let mut out_data = rfft.make_output_vec();
//let mut in_data = [1., 0.4, 0.3, -1.];
let mut in_data = [1.; 40];
//let mut in_data = [
rfft.process_with_scratch(&mut in_data, &mut out_data, &mut scratch).unwrap();
println!("{:?}", &out_data);
let scale = 1./40.;
for elem in out_data {
println!("{}", elem.norm_sqr().sqrt() * scale);
println!("{}", elem.l1_norm() * scale);
//println!("{}", elem * scale);
}
}
|