From 3a1bf31cc7594e3b1c3847e9d99f88d89e30fada Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Mon, 3 Feb 2025 11:16:10 +0200 Subject: [PATCH] rust: Remove G3p2 from cache --- .../unpolarized/spacelike/as1aem1.rs | 29 +++++++++++++++++-- crates/ekore/src/harmonics/cache.rs | 2 -- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs index 99e469151..db1c0d3dd 100644 --- a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs +++ b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs @@ -4,6 +4,7 @@ use num::complex::Complex; use crate::constants::{ChargeCombinations, CA, CF, ED2, EU2, NC, TR, ZETA2, ZETA3}; use crate::harmonics::cache::{Cache, K}; +use std::f64::consts::PI; /// Compute the photon-quark anomalous dimension. /// @@ -112,6 +113,16 @@ pub fn gamma_gg(_c: &mut Cache, _nf: u8) -> Complex { cmplx!(4.0 * TR * (NC as f64), 0.) } +/// Shift for $g_3(N)$ by 2. +/// +/// This is $g_3(N+2) - g_3(N)$. +fn g3_shift(c: &mut Cache) -> Complex { + let n = c.n(); + let S1 = c.get(K::S1); + (6. * (n + 1.) * (2. * n + 1.) * S1 + n * (-PI.powi(2) * (n + 1.).powu(2) - 6. * n)) + / (6. * n.powu(2) * (n + 1.).powu(3)) +} + /// Compute the singlet-like non-singlet anomalous dimension. /// /// Implements Eqs. (33-34) of [\[deFlorian:2015ujt\]][crate::bib::deFlorian2015ujt]. @@ -128,7 +139,7 @@ pub fn gamma_nsp(c: &mut Cache, _nf: u8) -> Complex { let S3p1h = c.get(K::S3ph); let g3N = c.get(K::G3); - let g3Np2 = c.get(K::G3p2); + let g3Np2 = g3N + g3_shift(c); #[rustfmt::skip] let result = 32.0 * ZETA2 * S1h - 32.0 * ZETA2 * S1p1h @@ -159,7 +170,7 @@ pub fn gamma_nsm(c: &mut Cache, _nf: u8) -> Complex { let S2p1h = c.get(K::S2ph); let S3p1h = c.get(K::S3ph); let g3N = c.get(K::G3); - let g3Np2 = c.get(K::G3p2); + let g3Np2 = g3N + g3_shift(c); #[rustfmt::skip] let result = @@ -302,4 +313,18 @@ mod tests { let me = gamma_nsp(&mut c, NF) + gamma_gq(&mut c, NF) + gamma_phq(&mut c, NF); assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-4); } + + #[test] + fn test_g3_shift() { + for N in [cmplx!(1.23, 0.), cmplx!(5., 0.), cmplx!(2., 1.)] { + let mut c = Cache::new(N); + let mut c2 = Cache::new(N + 2.); + assert_approx_eq_cmplx!( + f64, + g3_shift(&mut c), + c2.get(K::G3) - c.get(K::G3), + epsilon = 1e-6 + ); + } + } } diff --git a/crates/ekore/src/harmonics/cache.rs b/crates/ekore/src/harmonics/cache.rs index a9dc6ad25..1e15a0a30 100644 --- a/crates/ekore/src/harmonics/cache.rs +++ b/crates/ekore/src/harmonics/cache.rs @@ -51,7 +51,6 @@ pub enum K { S2ph, S3ph, S1p2, - G3p2, } /// Hold all cached values. @@ -96,7 +95,6 @@ impl Cache { K::S2mh => w2::S2((self.n - 1.) / 2.), K::S3mh => w3::S3((self.n - 1.) / 2.), K::G3 => g_functions::g3(self.n, self.get(K::S1)), - K::G3p2 => g_functions::g3(self.n + 2., self.get(K::S1p2)), K::Sm1e => w1::Sm1e(self.get(K::S1), self.get(K::S1h)), K::Sm1o => w1::Sm1o(self.get(K::S1), self.get(K::S1mh)), K::Sm2e => w2::Sm2e(self.get(K::S2), self.get(K::S2h)),