fn assert_close<D>(a: ArrayView<f64, D>, b: ArrayView<f64, D>)
    where
        D: Dimension,
    {
        let diff = (&a - &b).mapv_into(f64::abs);

        let rtol = 1e-7;
        let atol = 1e-12;
        let crtol = b.mapv(|x| x.abs() * rtol);
        let tol = crtol + atol;
        let tol_m_diff = &diff - &tol;
        let maxdiff = tol_m_diff.fold(0. / 0., |x, y| f64::max(x, *y));
        println!("diff offset from tolerance level= {:.2e}", maxdiff);
        if maxdiff > 0. {
            println!("{:.4?}", a);
            println!("{:.4?}", b);
            panic!("results differ");
        }
    }
// stolen from ndarray - not currently exported.
stolen from ndarray - not currently exported.
stolen from ndarray - not currently exported .
fn assert_close<D>(a: ArrayView<f64, D>, b: ArrayView<f64, D>)
    where
        D: Dimension,
    {
        let diff = (&a - &b).mapv_into(f64::abs);
        let rtol = 1e-7;
        let atol = 1e-12;
        let crtol = b.mapv(|x| x.abs() * rtol);
        let tol = crtol + atol;
        let tol_m_diff = &diff - &tol;
        let maxdiff = tol_m_diff.fold(0. / 0., |x, y| f64::max(x, *y));
        println!("diff offset from tolerance level= {:.2e}", maxdiff);
        if maxdiff > 0. {
            println!("{:.4?}", a);
            println!("{:.4?}", b);
            panic!("results differ");
        }
    }
fn assert_close < D > ( a : ArrayView < f64 , D > , b : ArrayView < f64 , D > ) where D : Dimension , { let diff = ( & a - & b ) . mapv_into ( f64 :: abs ) ; let rtol = 1e-7 ; let atol = 1e-12 ; let crtol = b . mapv ( | x | x . abs ( ) * rtol ) ; let tol = crtol + atol ; let tol_m_diff = & diff - & tol ; let maxdiff = tol_m_diff . fold ( 0. / 0. , | x , y | f64 :: max ( x , * y ) ) ; println ! ( " " maxdiff ) ; if maxdiff > 0. { println ! ( " " a ) ; println ! ( " " b ) ; panic ! ( " " ) ; } }
stolen from ndarray - not currently exported.
stolen from ndarray - not currently exported .
a
ArrayView<f64, D>
b
ArrayView<f64, D>
a
ArrayView<f64, D>
b
ArrayView<f64, D>