arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/poulpy-hal/src/reference/fft64/mod.rs
poulpy-hal/src/reference/fft64/mod.rsRaw
 1pub mod reim;
 2pub mod reim4;
 3pub mod svp;
 4pub mod vec_znx_big;
 5pub mod vec_znx_dft;
 6pub mod vmp;
 7
 8pub(crate) fn assert_approx_eq_slice(a: &[f64], b: &[f64], tol: f64) {
 9    assert_eq!(a.len(), b.len(), "Slices have different lengths");
10
11    for (i, (x, y)) in a.iter().zip(b.iter()).enumerate() {
12        let diff: f64 = (x - y).abs();
13        let scale: f64 = x.abs().max(y.abs()).max(1.0);
14        assert!(
15            diff <= tol * scale,
16            "Difference at index {}: left={} right={} rel_diff={} > tol={}",
17            i,
18            x,
19            y,
20            diff / scale,
21            tol
22        );
23    }
24}