diff --git a/crates/ekore/src/operator_matrix_elements/unpolarized/spacelike/as2.rs b/crates/ekore/src/operator_matrix_elements/unpolarized/spacelike/as2.rs index bf74badc8..4376b084b 100644 --- a/crates/ekore/src/operator_matrix_elements/unpolarized/spacelike/as2.rs +++ b/crates/ekore/src/operator_matrix_elements/unpolarized/spacelike/as2.rs @@ -46,7 +46,7 @@ pub fn A_qq_ns(c: &mut Cache, _nf: u8, L: f64) -> Complex { /// Implements Eq. (B.1) of [\[Buza:1996wv\]](crate::bib::Buza1996wv). pub fn A_hq_ps(c: &mut Cache, _nf: u8, L: f64) -> Complex { let N = c.n(); - let S2 = c.get(K::S1); + let S2 = c.get(K::S2); let F1M = 1.0 / (N - 1.0) * (ZETA2 - (S2 - 1.0 / N.powu(2))); let F11 = 1.0 / (N + 1.0) * (ZETA2 - (S2 + 1.0 / (N + 1.0).powu(2))); let F12 = 1.0 / (N + 2.0) * (ZETA2 - (S2 + 1.0 / (N + 1.0).powu(2) + 1.0 / (N + 2.0).powu(2))); @@ -289,10 +289,9 @@ pub fn A_ns(c: &mut Cache, nf: u8, L: f64) -> [[Complex; 2]; 2] { #[cfg(test)] mod test { - use crate::cmplx; - use crate::{ - harmonics::cache::Cache, operator_matrix_elements::unpolarized::spacelike::as2::*, - }; + use super::*; + use crate::{assert_approx_eq_cmplx, cmplx}; + use float_cmp::assert_approx_eq; use num::complex::Complex; const NF: u8 = 5; @@ -304,8 +303,7 @@ mod test { let N = cmplx![1., 0.]; let mut c = Cache::new(N); let aNSqq2 = A_qq_ns(&mut c, NF, L); - assert_approx_eq!(f64, aNSqq2.re, 0.0, epsilon = 2e-11); - assert_approx_eq!(f64, aNSqq2.im, 0.0, epsilon = 2e-11); + assert_approx_eq_cmplx!(f64, aNSqq2, Complex::zero(), epsilon = 2e-11); } } @@ -318,22 +316,20 @@ mod test { let aS2 = A_singlet(&mut c, NF, L, false); // gluon momenum conservation - assert_approx_eq!( + assert_approx_eq_cmplx!( f64, - (aS2[0][0] + aS2[1][0] + aS2[2][0]).re, - 0.0, - epsilon = 2e-6 - ); - assert_approx_eq!( - f64, - (aS2[0][0] + aS2[1][0] + aS2[2][0]).im, - 0.0, + aS2[0][0] + aS2[1][0] + aS2[2][0], + Complex::zero(), epsilon = 2e-6 ); // quark momentum conservation - // assert_approx_eq!(f64, (aS2[0][1] + aS2[1][1] + aS2[2][1]).re, 0.0, epsilon = 1e-11); - // assert_approx_eq!(f64, (aS2[0][1] + aS2[1][1] + aS2[2][1]).im, 0.0, epsilon = 1e-11); + assert_approx_eq_cmplx!( + f64, + aS2[0][1] + aS2[1][1] + aS2[2][1], + Complex::zero(), + epsilon = 1e-11 + ); } } }