Skip to content

Commit

Permalink
fix bug in Ahqps
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiani committed Sep 11, 2024
1 parent fc01791 commit b7932aa
Showing 1 changed file with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn A_qq_ns(c: &mut Cache, _nf: u8, L: f64) -> Complex<f64> {
/// Implements Eq. (B.1) of [\[Buza:1996wv\]](crate::bib::Buza1996wv).
pub fn A_hq_ps(c: &mut Cache, _nf: u8, L: f64) -> Complex<f64> {
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)));
Expand Down Expand Up @@ -289,10 +289,9 @@ pub fn A_ns(c: &mut Cache, nf: u8, L: f64) -> [[Complex<f64>; 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;
Expand All @@ -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);
}
}

Expand All @@ -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
);
}
}
}

0 comments on commit b7932aa

Please sign in to comment.