diff --git a/Cargo.toml b/Cargo.toml index 9bb5cd3..ae150bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,17 +16,10 @@ num-complex = { version = "0.4.0", features = ["serde"], default-features = fals num-traits = { version = "0.2.14", features = ["libm"], default-features = false} [dev-dependencies] -easybench = "1.0" rand = "0.8" -ndarray = "0.15" rustfft = "6.1.0" -iai-callgrind = "0.10.0" # futuredsp = "0.0.6" # sdr = "0.7.0" -[[bench]] -name = "micro" -harness = false - [profile.release] debug = 1 diff --git a/benches/micro.rs b/benches/micro.rs deleted file mode 100644 index 116b3a2..0000000 --- a/benches/micro.rs +++ /dev/null @@ -1,19 +0,0 @@ -use core::f32::consts::PI; -use core::hint::black_box; - -use iai_callgrind::{library_benchmark, library_benchmark_group, main}; - -use idsp::{atan2, cossin, iir, Filter, Lowpass, PLL, RPLL}; - -#[library_benchmark] -#[bench::some(-0x7304_2531_i32)] -fn bench_cossin(zi: i32) { - black_box(cossin(zi)); -} - -library_benchmark_group!( - name = bench_cossin_group; - benchmarks = bench_cossin -); - -main!(library_benchmark_groups = bench_cossin_group); diff --git a/src/rpll.rs b/src/rpll.rs index e307d96..0bf0b0b 100644 --- a/src/rpll.rs +++ b/src/rpll.rs @@ -93,7 +93,6 @@ impl RPLL { #[cfg(test)] mod test { use super::RPLL; - use ndarray::prelude::*; use rand::{prelude::*, rngs::StdRng}; use std::vec::Vec; @@ -175,14 +174,12 @@ mod test { self.run(t_settle); let (y, f) = self.run(n); - let y = Array::from(y); - let f = Array::from(f); // println!("{:?} {:?}", f, y); - let fm = f.mean().unwrap(); - let fs = f.std_axis(Axis(0), 0.).into_scalar(); - let ym = y.mean().unwrap(); - let ys = y.std_axis(Axis(0), 0.).into_scalar(); + let fm = f.iter().copied().sum::() / f.len() as f32; + let fs = f.iter().map(|f| (*f - fm).powi(2)).sum::().sqrt() / f.len() as f32; + let ym = y.iter().copied().sum::() / y.len() as f32; + let ys = y.iter().map(|y| (*y - ym).powi(2)).sum::().sqrt() / y.len() as f32; println!("f: {:.2e}±{:.2e}; y: {:.2e}±{:.2e}", fm, fs, ym, ys);