diff options
Diffstat (limited to 'src/bin/testrfft.rs')
-rw-r--r-- | src/bin/testrfft.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/bin/testrfft.rs b/src/bin/testrfft.rs new file mode 100644 index 0000000..ee8c72f --- /dev/null +++ b/src/bin/testrfft.rs @@ -0,0 +1,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); + } +} |