dsp/testing: simplify

This commit is contained in:
Robert Jördens 2020-12-18 15:46:21 +01:00
parent 2f122d12fa
commit 12d5945d81

View File

@ -1,3 +1,4 @@
#![allow(dead_code)]
use super::Complex; use super::Complex;
pub fn isclose(a: f64, b: f64, rtol: f64, atol: f64) -> bool { pub fn isclose(a: f64, b: f64, rtol: f64, atol: f64) -> bool {
@ -23,9 +24,7 @@ pub fn complex_allclose(
rtol: f32, rtol: f32,
atol: f32, atol: f32,
) -> bool { ) -> bool {
let mut result: bool = true; a.iter()
a.iter().zip(b.iter()).for_each(|(i, j)| { .zip(b)
result &= complex_isclose(*i, *j, rtol, atol); .all(|(&i, &j)| complex_isclose(i, j, rtol, atol))
});
result
} }