From e054c2a14165d7d6773d0a2001d3745d4d081833 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Sat, 21 Sep 2024 15:14:11 +0300 Subject: [PATCH 1/8] Add rusty ad.p.s.as1 --- .../src/anomalous_dimensions/polarized.rs | 3 + .../polarized/spacelike.rs | 57 ++++++++++++++ .../polarized/spacelike/as1.rs | 78 +++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 crates/ekore/src/anomalous_dimensions/polarized.rs create mode 100644 crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs create mode 100644 crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs diff --git a/crates/ekore/src/anomalous_dimensions/polarized.rs b/crates/ekore/src/anomalous_dimensions/polarized.rs new file mode 100644 index 000000000..501138f09 --- /dev/null +++ b/crates/ekore/src/anomalous_dimensions/polarized.rs @@ -0,0 +1,3 @@ +//! The polarized anomalous dimensions for space-like kinematics. + +pub mod spacelike; diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs new file mode 100644 index 000000000..8526b53b1 --- /dev/null +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs @@ -0,0 +1,57 @@ +//! The polarized, space-like anomalous dimensions at various couplings power. + +use crate::constants::{PID_NSM, PID_NSP, PID_NSV}; +use crate::harmonics::cache::Cache; +use num::complex::Complex; +use num::Zero; +pub mod as1; +// pub mod as2; +// pub mod as3; + +/// Compute the tower of the non-singlet anomalous dimensions. +pub fn gamma_ns_qcd(order_qcd: usize, mode: u16, c: &mut Cache, nf: u8) -> Vec> { + let mut gamma_ns = vec![Complex::::zero(); order_qcd]; + gamma_ns[0] = as1::gamma_ns(c, nf); + // // NLO and beyond + // if order_qcd >= 2 { + // let gamma_ns_1 = match mode { + // PID_NSP => as2::gamma_nsp(c, nf), + // // To fill the full valence vector in NNLO we need to add gamma_ns^1 explicitly here + // PID_NSM | PID_NSV => as2::gamma_nsm(c, nf), + // _ => panic!("Unkown non-singlet sector element"), + // }; + // gamma_ns[1] = gamma_ns_1 + // } + // // NNLO and beyond + // if order_qcd >= 3 { + // let gamma_ns_2 = match mode { + // PID_NSP => as3::gamma_nsp(c, nf), + // PID_NSM => as3::gamma_nsm(c, nf), + // PID_NSV => as3::gamma_nsv(c, nf), + // _ => panic!("Unkown non-singlet sector element"), + // }; + // gamma_ns[2] = gamma_ns_2 + // } + gamma_ns +} + +/// Compute the tower of the singlet anomalous dimension matrices. +pub fn gamma_singlet_qcd(order_qcd: usize, c: &mut Cache, nf: u8) -> Vec<[[Complex; 2]; 2]> { + let mut gamma_S = vec![ + [ + [Complex::::zero(), Complex::::zero()], + [Complex::::zero(), Complex::::zero()] + ]; + order_qcd + ]; + gamma_S[0] = as1::gamma_singlet(c, nf); + // // NLO and beyond + // if order_qcd >= 2 { + // gamma_S[1] = as2::gamma_singlet(c, nf); + // } + // // NNLO and beyond + // if order_qcd >= 3 { + // gamma_S[2] = as3::gamma_singlet(c, nf); + // } + gamma_S +} diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs new file mode 100644 index 000000000..7a12664c9 --- /dev/null +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs @@ -0,0 +1,78 @@ +//! |LO| |QCD|. + +use num::complex::Complex; + +use super::super::unpolarized::spacelike::as1::gamma_ns; +use crate::constants::{CA, CF, TR}; +use crate::harmonics::cache::{Cache, K}; + +/// Compute the quark-gluon anomalous dimension. +/// +/// Implements Eq. (A.1) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_qg(c: &mut Cache, _nf: u8) -> Complex { + let N = c.n(); + let gamma = -(N - 1) / N / (N + 1); + 2.0 * TR * 2.0 * nf * gamma +} + +/// Compute the gluon-quark anomalous dimension. +/// +/// Implements Eq. (A.1) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_gq(c: &mut Cache, _nf: u8) -> Complex { + let N = c.n(); + let gamma = -(N + 2) / N / (N + 1); + 2.0 * CF * gamma +} + +/// Compute the gluon-gluon anomalous dimension. +/// +/// Implements Eq. (A.1) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_gg(c: &mut Cache, nf: u8) -> Complex { + let N = c.n(); + let S1 = c.get(K::S1); + let gamma = -S1 + 2 / N / (N + 1); + CA * (-4.0 * gamma - 11.0 / 3.0) + 4.0 / 3.0 * TR * nf; +} + +/// Compute the singlet anomalous dimension matrix. +pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { + let gamma_qq = gamma_ns(c, nf); + [ + [gamma_qq, gamma_qg(c, nf)], + [gamma_gq(c, nf), gamma_gg(c, nf)], + ] +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::harmonics::cache::Cache; + use crate::{assert_approx_eq_cmplx, cmplx}; + use num::complex::Complex; + use num::Zero; + const NF: u8 = 5; + + #[test] + fn quark_momentum_conservation() { + const N: Complex = cmplx![2., 0.]; + let mut c = Cache::new(N); + let me = gamma_ns(&mut c, NF) + gamma_gq(&mut c, NF); + assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-12); + } + + #[test] + fn gluon_momentum_conservation() { + const N: Complex = cmplx![2., 0.]; + let mut c = Cache::new(N); + let me = gamma_qg(&mut c, NF) + gamma_gg(&mut c, NF); + assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-12); + } + + #[test] + fn qg_helicity_conservation() { + const N: Complex = cmplx![1., 0.]; + let mut c = Cache::new(N); + let me = gamma_qg(&mut c, NF); + assert_approx_eq_cmplx!(f64, me, Complex::Zero(), epsilon = 1e-12); + } +} From ae0f200988bcaed6b1fea74918f2351e4d604121 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Sat, 21 Sep 2024 15:40:00 +0300 Subject: [PATCH 2/8] rust: Fix ad.p.s.as1 --- crates/ekore/src/anomalous_dimensions.rs | 1 + .../polarized/spacelike/as1.rs | 33 +++++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions.rs b/crates/ekore/src/anomalous_dimensions.rs index 55a4dad43..ecb2e4038 100644 --- a/crates/ekore/src/anomalous_dimensions.rs +++ b/crates/ekore/src/anomalous_dimensions.rs @@ -1,3 +1,4 @@ //! The anomalous dimensions for |DGLAP| evolution. +pub mod polarized; pub mod unpolarized; diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs index 7a12664c9..2eec91867 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs @@ -2,17 +2,24 @@ use num::complex::Complex; -use super::super::unpolarized::spacelike::as1::gamma_ns; +use super::super::super::unpolarized::spacelike::as1::gamma_ns as unpol; use crate::constants::{CA, CF, TR}; use crate::harmonics::cache::{Cache, K}; +/// Compute the non-singlet anomalous dimension. +/// +/// Identical to the unpolarized counterpart. +pub fn gamma_ns(c: &mut Cache, nf: u8) -> Complex { + unpol(c, nf) +} + /// Compute the quark-gluon anomalous dimension. /// /// Implements Eq. (A.1) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. -pub fn gamma_qg(c: &mut Cache, _nf: u8) -> Complex { +pub fn gamma_qg(c: &mut Cache, nf: u8) -> Complex { let N = c.n(); - let gamma = -(N - 1) / N / (N + 1); - 2.0 * TR * 2.0 * nf * gamma + let gamma = -(N - 1.) / N / (N + 1.); + 2.0 * TR * 2.0 * (nf as f64) * gamma } /// Compute the gluon-quark anomalous dimension. @@ -20,7 +27,7 @@ pub fn gamma_qg(c: &mut Cache, _nf: u8) -> Complex { /// Implements Eq. (A.1) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. pub fn gamma_gq(c: &mut Cache, _nf: u8) -> Complex { let N = c.n(); - let gamma = -(N + 2) / N / (N + 1); + let gamma = -(N + 2.) / N / (N + 1.); 2.0 * CF * gamma } @@ -30,8 +37,8 @@ pub fn gamma_gq(c: &mut Cache, _nf: u8) -> Complex { pub fn gamma_gg(c: &mut Cache, nf: u8) -> Complex { let N = c.n(); let S1 = c.get(K::S1); - let gamma = -S1 + 2 / N / (N + 1); - CA * (-4.0 * gamma - 11.0 / 3.0) + 4.0 / 3.0 * TR * nf; + let gamma = -S1 + 2. / N / (N + 1.); + CA * (-4.0 * gamma - 11.0 / 3.0) + 4.0 / 3.0 * TR * (nf as f64) } /// Compute the singlet anomalous dimension matrix. @@ -54,25 +61,25 @@ mod tests { #[test] fn quark_momentum_conservation() { - const N: Complex = cmplx![2., 0.]; + const N: Complex = cmplx!(2., 0.); let mut c = Cache::new(N); let me = gamma_ns(&mut c, NF) + gamma_gq(&mut c, NF); - assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-12); + assert_approx_eq_cmplx!(f64, me, cmplx!((4. * CF) / 3., 0.), epsilon = 1e-12); } #[test] fn gluon_momentum_conservation() { - const N: Complex = cmplx![2., 0.]; + const N: Complex = cmplx!(2., 0.); let mut c = Cache::new(N); let me = gamma_qg(&mut c, NF) + gamma_gg(&mut c, NF); - assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-12); + assert_approx_eq_cmplx!(f64, me, cmplx!(3. + (NF as f64) / 3., 0.), epsilon = 1e-12); } #[test] fn qg_helicity_conservation() { - const N: Complex = cmplx![1., 0.]; + const N: Complex = cmplx!(1., 0.); let mut c = Cache::new(N); let me = gamma_qg(&mut c, NF); - assert_approx_eq_cmplx!(f64, me, Complex::Zero(), epsilon = 1e-12); + assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-12); } } From 80edf057ec2a0d3813d477dd556700fd95c6274e Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Sat, 21 Sep 2024 16:01:01 +0300 Subject: [PATCH 3/8] rust: Init ad.p.s.as2 --- .../polarized/spacelike.rs | 30 +-- .../polarized/spacelike/as2.rs | 206 ++++++++++++++++++ 2 files changed, 221 insertions(+), 15 deletions(-) create mode 100644 crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs index 8526b53b1..bb394deda 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs @@ -5,23 +5,23 @@ use crate::harmonics::cache::Cache; use num::complex::Complex; use num::Zero; pub mod as1; -// pub mod as2; +pub mod as2; // pub mod as3; /// Compute the tower of the non-singlet anomalous dimensions. pub fn gamma_ns_qcd(order_qcd: usize, mode: u16, c: &mut Cache, nf: u8) -> Vec> { let mut gamma_ns = vec![Complex::::zero(); order_qcd]; gamma_ns[0] = as1::gamma_ns(c, nf); - // // NLO and beyond - // if order_qcd >= 2 { - // let gamma_ns_1 = match mode { - // PID_NSP => as2::gamma_nsp(c, nf), - // // To fill the full valence vector in NNLO we need to add gamma_ns^1 explicitly here - // PID_NSM | PID_NSV => as2::gamma_nsm(c, nf), - // _ => panic!("Unkown non-singlet sector element"), - // }; - // gamma_ns[1] = gamma_ns_1 - // } + // NLO and beyond + if order_qcd >= 2 { + let gamma_ns_1 = match mode { + PID_NSP => as2::gamma_nsp(c, nf), + // To fill the full valence vector in NNLO we need to add gamma_ns^1 explicitly here + PID_NSM | PID_NSV => as2::gamma_nsm(c, nf), + _ => panic!("Unkown non-singlet sector element"), + }; + gamma_ns[1] = gamma_ns_1 + } // // NNLO and beyond // if order_qcd >= 3 { // let gamma_ns_2 = match mode { @@ -45,10 +45,10 @@ pub fn gamma_singlet_qcd(order_qcd: usize, c: &mut Cache, nf: u8) -> Vec<[[Compl order_qcd ]; gamma_S[0] = as1::gamma_singlet(c, nf); - // // NLO and beyond - // if order_qcd >= 2 { - // gamma_S[1] = as2::gamma_singlet(c, nf); - // } + // NLO and beyond + if order_qcd >= 2 { + gamma_S[1] = as2::gamma_singlet(c, nf); + } // // NNLO and beyond // if order_qcd >= 3 { // gamma_S[2] = as3::gamma_singlet(c, nf); diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs new file mode 100644 index 000000000..3b3779b0f --- /dev/null +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs @@ -0,0 +1,206 @@ +//! |NLO| |QCD|. + +use num::complex::Complex; +use num::Zero; + +use super::super::super::unpolarized::spacelike::as2::gamma_nsm as unpol_nsm; +use super::super::super::unpolarized::spacelike::as2::gamma_nsp as unpol_nsp; +use crate::constants::{CA, CF, TR, ZETA2, ZETA3}; +use crate::harmonics::cache::{Cache, K}; + +pub fn gamma_nsm(c: &mut Cache, nf: u8) -> Complex { + unpol_nsp(c, nf) +} + +pub fn gamma_nsp(c: &mut Cache, nf: u8) -> Complex { + unpol_nsm(c, nf) +} + +/// Compute the pure-singlet quark-quark anomalous dimension. +/// +/// Implements Eq. (A.3) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_ps(c: &mut Cache, nf: u8) -> Complex { + let n = c.n(); + let gqqps1_nfcf = (2. * (n + 2.) * (1. + 2. * n + n.powu(3))) / ((1. + n).powu(3) * n.powu(3)); + 4.0 * TR * (nf as f64) * CF * gqqps1_nfcf +} + +/// Compute the quark-gluon singlet anomalous dimension. +/// +/// Implements Eq. (A.4) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_qg(c: &mut Cache, nf: u8) -> Complex { + let n = c.n(); + let S1 = c.get(K::S1); + let S2 = c.get(K::S2); + let Sp2m = c.get(K::S2mh); + + #[rustfmt::skip] + let gqg1_nfca = ( + (S1.powu(2) - S2 + Sp2m) * (n - 1.) / (n * (n + 1.)) + - 4. * S1 / (n * (1. + n).powu(2)) + - (-2. - 7. * n + 3. * n.powu(2) - 4. * n.powu(3) + n.powu(4) + n.powu(5)) / (n.powu(3) * (1. + n).powu(3)) + ) * 2.0; + #[rustfmt::skip] + let gqg1_nfcf = ( + (-(S1.powu(2)) + S2 + 2. * S1 / n) * (n - 1.) / (n * (n + 1.)) + - (n - 1.) + * (1. + 3.5 * n + 4. * n.powu(2) + 5. * n.powu(3) + 2.5 * n.powu(4)) + / (n.powu(3) * (1. + n).powu(3)) + + 4. * (n - 1.) / (n.powu(2) * (1. + n).powu(2)) + ) * 2.; + 4.0 * TR * (nf as f64) * (CA * gqg1_nfca + CF * gqg1_nfcf) +} + +/// Compute the gluon-quark singlet anomalous dimension. +/// +/// Implements Eq. (A.5) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_gq(c: &mut Cache, nf: u8) -> Complex { + Complex::zero() + // let N = c.n(); + // let S1 = c.get(K::S1); + // let S2 = c.get(K::S2); + // let Sp2m = c.get(K::S2mh); + // #[rustfmt::skip] + // let ggq1_cfcf = ( + // (2 * (S1**2 + S2) * (n + 2)) / (n * (n + 1)) + // - (2 * S1 * (n + 2) * (1 + 3 * n)) / (n * (1 + n) ** 2) + // - ((n + 2) * (2 + 15 * n + 8 * n**2 - 12.0 * n**3 - 9.0 * n**4)) + // / (n**3 * (1 + n) ** 3) + // + 8 * (n + 2) / (n**2 * (1 + n) ** 2) + // ) * 0.5; + // #[rustfmt::skip] + // let ggq1_cfca = -(-(-(S1 * *2) - S2 + Sp2m) * (n + 2) / (n * (n + 1)) + // - S1 * (12 + 22 * n + 11 * n * *2) / (3 * n * *2 * (n + 1)) + // + (36 + 72 * n + 41 * n * *2 + 254 * n * *3 + 271 * n * *4 + 76 * n * *5) + // / (9 * n * *3 * (1 + n) * *3)); + // #[rustfmt::skip] + // let ggq1_cfnf = + // (-S1 * (n + 2)) / (3 * n * (n + 1)) + ((n + 2) * (2 + 5 * n)) / (9 * n * (1 + n) * *2); + // 4 * CF * (CA * ggq1_cfca + CF * ggq1_cfcf + 4.0 * TR * nf * ggq1_cfnf) +} + +/// Compute the gluon-gluon singlet anomalous dimension. +/// +/// Implements Eq. (A.6) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. +pub fn gamma_gg(c: &mut Cache, nf: u8) -> Complex { + Complex::zero() + // let n = c.n(); + // let S1 = c.get(K::S1); + // let Sp1m = c.get(K::S1mh); + // let Sp2m = c.get(K::S2mh); + // let Sp3m = c.get(K::S3mh); + // let S1h = c.get(K::S1h); + // let g3n = c.get(K::G3); + // let SSCHLM = ZETA2 / 2 * (Sp1m - S1h + 2. / n) - S1 / n * *2 - g3 - 5 * ZETA3 / 8.; + // #[rustfmt::skip] + // let ggg1_caca = ( + // -4 * S1 * Sp2m + // - Sp3m + // + 8 * SSCHLM + // + 8 * Sp2m / (n * (n + 1)) + // + 2.0 + // * S1 + // * (72 + 144 * n + 67 * n**2 + 134 * n**3 + 67 * n**4) + // / (9 * n**2 * (n + 1) ** 2) + // - (144 + 258 * n + 7 * n**2 + 698 * n**3 + 469 * n**4 + 144 * n**5 + 48 * n**6) + // / (9 * n**3 * (1 + n) ** 3) + // ) * 0.5; + // #[rustfmt::skip] + // let ggg1_canf = ( + // -5 * S1 / 9 + // + (-3 + 13 * n + 16 * n**2 + 6 * n**3 + 3 * n**4) / (9 * n**2 * (1 + n) ** 2) + // ) * 4; + // #[rustfmt::skip] + // let ggg1_cfnf = (4 + 2 * n - 8 * n**2 + n**3 + 5 * n**4 + 3 * n**5 + n**6) / ( + // n**3 * (1 + n) ** 3 + // ); + // 4 * (CA * *2 * ggg1_caca + TR * nf * (CA * ggg1_canf + CF * ggg1_cfnf)) +} + +/// Compute the singlet anomalous dimension matrix. +pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { + let gamma_qq = gamma_nsp(c, nf) + gamma_ps(c, nf); + [ + [gamma_qq, gamma_qg(c, nf)], + [gamma_gq(c, nf), gamma_gg(c, nf)], + ] +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::harmonics::cache::Cache; + use crate::{assert_approx_eq_cmplx, cmplx}; + use num::complex::Complex; + use num::traits::Pow; + use num::Zero; + use std::f64::consts::PI; + + const NF: u8 = 5; + + #[test] + fn physical_constraints() { + // qg_helicity_conservation + let mut c = Cache::new(cmplx!(1., 0.)); + assert_approx_eq_cmplx!(f64, gamma_qg(&mut c, NF), Complex::zero(), epsilon = 2e-6); + + // // qg momentum + // let mut c = Cache::new(cmplx!(1., 0.)); + // let gS1 = gamma_singlet(&mut c, NF); + // assert_approx_eq_cmplx!(f64, gS1[0][0], cmplx!(12. * TR * (NF as f64) * CF, 0.), epsilon = 1e-6); + } + + // #[test] + // fn N2() { + // // reference values are obtained from MMa + // let mut c = Cache::new(cmplx!(2., 0.)); + + // // ns+ + // assert_approx_eq_cmplx!( + // f64, + // gamma_nsp(&mut c, NF), + // cmplx!( + // (-112.0 * CF + 376.0 * CA - 64.0 * (NF as f64)) * CF / 27.0, + // 0. + // ), + // epsilon = 2e-6 + // ); + + // // ns- + // let check = ((34.0 / 27.0 * (-47.0 + 6. * PI.pow(2)) - 16.0 * ZETA3) * CF + // + (373.0 / 9.0 - 34.0 * PI.pow(2) / 9.0 + 8.0 * ZETA3) * CA + // - 64.0 * (NF as f64) / 27.0) + // * CF; + // assert_approx_eq_cmplx!( + // f64, + // gamma_nsm(&mut c, NF), + // cmplx!(check, 0.), + // epsilon = 2e-6 + // ); + + // // singlet sector + // let gS1 = gamma_singlet(&mut c, NF); + // // ps + // assert_approx_eq_cmplx!( + // f64, + // gamma_ps(&mut c, NF), + // cmplx!(-40.0 * CF * (NF as f64) / 27.0, 0.) + // ); + // // qg + // assert_approx_eq_cmplx!( + // f64, + // gS1[0][1], + // cmplx!((-74.0 * CF - 35.0 * CA) * (NF as f64) / 27.0, 0.) + // ); + // // gq + // assert_approx_eq_cmplx!( + // f64, + // gS1[1][0], + // cmplx!( + // (112.0 * CF - 376.0 * CA + 104.0 * (NF as f64)) * CF / 27.0, + // 0. + // ), + // epsilon = 1e-13 + // ); + // } +} From e6ef4dc00b0cfb324a655c5f1eb3b1bb1b30e7a5 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 26 Sep 2024 19:07:28 +0300 Subject: [PATCH 4/8] rust: Add ad.p.s.as2.gq --- .../polarized/spacelike/as2.rs | 130 ++++++++---------- 1 file changed, 55 insertions(+), 75 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs index 3b3779b0f..0ec794360 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs @@ -55,28 +55,30 @@ pub fn gamma_qg(c: &mut Cache, nf: u8) -> Complex { /// /// Implements Eq. (A.5) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. pub fn gamma_gq(c: &mut Cache, nf: u8) -> Complex { - Complex::zero() - // let N = c.n(); - // let S1 = c.get(K::S1); - // let S2 = c.get(K::S2); - // let Sp2m = c.get(K::S2mh); - // #[rustfmt::skip] - // let ggq1_cfcf = ( - // (2 * (S1**2 + S2) * (n + 2)) / (n * (n + 1)) - // - (2 * S1 * (n + 2) * (1 + 3 * n)) / (n * (1 + n) ** 2) - // - ((n + 2) * (2 + 15 * n + 8 * n**2 - 12.0 * n**3 - 9.0 * n**4)) - // / (n**3 * (1 + n) ** 3) - // + 8 * (n + 2) / (n**2 * (1 + n) ** 2) - // ) * 0.5; - // #[rustfmt::skip] - // let ggq1_cfca = -(-(-(S1 * *2) - S2 + Sp2m) * (n + 2) / (n * (n + 1)) - // - S1 * (12 + 22 * n + 11 * n * *2) / (3 * n * *2 * (n + 1)) - // + (36 + 72 * n + 41 * n * *2 + 254 * n * *3 + 271 * n * *4 + 76 * n * *5) - // / (9 * n * *3 * (1 + n) * *3)); - // #[rustfmt::skip] - // let ggq1_cfnf = - // (-S1 * (n + 2)) / (3 * n * (n + 1)) + ((n + 2) * (2 + 5 * n)) / (9 * n * (1 + n) * *2); - // 4 * CF * (CA * ggq1_cfca + CF * ggq1_cfcf + 4.0 * TR * nf * ggq1_cfnf) + let n = c.n(); + let S1 = c.get(K::S1); + let S2 = c.get(K::S2); + let Sp2m = c.get(K::S2mh); + #[rustfmt::skip] + let ggq1_cfcf = ( + (2. * (S1.powu(2) + S2) * (n + 2.)) / (n * (n + 1.)) + - (2. * S1 * (n + 2.) * (1. + 3. * n)) / (n * (1. + n).powu(2)) + - ((n + 2.) * (2. + 15. * n + 8. * n.powu(2) - 12.0 * n.powu(3) - 9.0 * n.powu(4))) + / (n.powu(3) * (1. + n).powu(3)) + + 8. * (n + 2.) / (n.powu(2) * (1. + n).powu(2)) + ) * 0.5; + #[rustfmt::skip] + let ggq1_cfca = -( + -(-(S1.powu(2)) - S2 + Sp2m) * (n + 2.) / (n * (n + 1.)) + - S1 * (12. + 22. * n + 11. * n.powu(2)) / (3. * n.powu(2) * (n + 1.)) + + (36. + 72. * n + 41. * n.powu(2) + 254. * n.powu(3) + 271. * n.powu(4) + 76. * n.powu(5)) + / (9. * n.powu(3) * (1. + n).powu(3)) + ); + #[rustfmt::skip] + let ggq1_cfnf =(-S1 * (n + 2.)) / (3. * n * (n + 1.)) + ((n + 2.) * (2. + 5. * n)) / ( + 9. * n * (1. + n).powu(2) + ); + 4. * CF * (CA * ggq1_cfca + CF * ggq1_cfcf + 4.0 * TR * (nf as f64) * ggq1_cfnf) } /// Compute the gluon-gluon singlet anomalous dimension. @@ -150,57 +152,35 @@ mod tests { // assert_approx_eq_cmplx!(f64, gS1[0][0], cmplx!(12. * TR * (NF as f64) * CF, 0.), epsilon = 1e-6); } - // #[test] - // fn N2() { - // // reference values are obtained from MMa - // let mut c = Cache::new(cmplx!(2., 0.)); - - // // ns+ - // assert_approx_eq_cmplx!( - // f64, - // gamma_nsp(&mut c, NF), - // cmplx!( - // (-112.0 * CF + 376.0 * CA - 64.0 * (NF as f64)) * CF / 27.0, - // 0. - // ), - // epsilon = 2e-6 - // ); - - // // ns- - // let check = ((34.0 / 27.0 * (-47.0 + 6. * PI.pow(2)) - 16.0 * ZETA3) * CF - // + (373.0 / 9.0 - 34.0 * PI.pow(2) / 9.0 + 8.0 * ZETA3) * CA - // - 64.0 * (NF as f64) / 27.0) - // * CF; - // assert_approx_eq_cmplx!( - // f64, - // gamma_nsm(&mut c, NF), - // cmplx!(check, 0.), - // epsilon = 2e-6 - // ); - - // // singlet sector - // let gS1 = gamma_singlet(&mut c, NF); - // // ps - // assert_approx_eq_cmplx!( - // f64, - // gamma_ps(&mut c, NF), - // cmplx!(-40.0 * CF * (NF as f64) / 27.0, 0.) - // ); - // // qg - // assert_approx_eq_cmplx!( - // f64, - // gS1[0][1], - // cmplx!((-74.0 * CF - 35.0 * CA) * (NF as f64) / 27.0, 0.) - // ); - // // gq - // assert_approx_eq_cmplx!( - // f64, - // gS1[1][0], - // cmplx!( - // (112.0 * CF - 376.0 * CA + 104.0 * (NF as f64)) * CF / 27.0, - // 0. - // ), - // epsilon = 1e-13 - // ); - // } + #[test] + fn N2() { + let mut c = Cache::new(cmplx!(2., 0.)); + + // singlet sector + let gS1 = gamma_singlet(&mut c, NF); + // // ps + // assert_approx_eq_cmplx!( + // f64, + // gamma_ps(&mut c, NF), + // cmplx!(-40.0 * CF * (NF as f64) / 27.0, 0.) + // ); + // // qg + // assert_approx_eq_cmplx!( + // f64, + // gS1[0][1], + // cmplx!((-74.0 * CF - 35.0 * CA) * (NF as f64) / 27.0, 0.) + // ); + // gq + assert_approx_eq_cmplx!( + f64, + -gS1[1][0], + cmplx!( + 4. * (-2.074074074074074 * CF.pow(2) + + CA * CF * (29. / 54. - 2. / 3. * (1. / 2. - PI.pow(2) / 3.)) + + (4. * CF * (NF as f64) * TR) / 27.), + 0. + ), + epsilon = 1e-13 + ); + } } From 4fe3452beaad666acc11cd856c8f6c336979eed8 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 26 Sep 2024 19:09:48 +0300 Subject: [PATCH 5/8] rust: Test ad.p.s.as2.ps --- .../anomalous_dimensions/polarized/spacelike/as2.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs index 0ec794360..919225788 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs @@ -158,12 +158,12 @@ mod tests { // singlet sector let gS1 = gamma_singlet(&mut c, NF); - // // ps - // assert_approx_eq_cmplx!( - // f64, - // gamma_ps(&mut c, NF), - // cmplx!(-40.0 * CF * (NF as f64) / 27.0, 0.) - // ); + // ps + assert_approx_eq_cmplx!( + f64, + -gamma_ps(&mut c, NF), + cmplx!(-4.0 * CF * TR * (NF as f64) * 13. / 27.0, 0.) + ); // // qg // assert_approx_eq_cmplx!( // f64, From d1c114ed9a11a935a4402a5493fc84166425b2be Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 26 Sep 2024 19:22:13 +0300 Subject: [PATCH 6/8] rust: Add ad.p.s.as2.gg --- .../polarized/spacelike/as2.rs | 94 ++++++++++--------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs index 919225788..69144c17e 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs @@ -85,38 +85,37 @@ pub fn gamma_gq(c: &mut Cache, nf: u8) -> Complex { /// /// Implements Eq. (A.6) of [\[Gluck:1995yr\]][crate::bib::Gluck1995yr]. pub fn gamma_gg(c: &mut Cache, nf: u8) -> Complex { - Complex::zero() - // let n = c.n(); - // let S1 = c.get(K::S1); - // let Sp1m = c.get(K::S1mh); - // let Sp2m = c.get(K::S2mh); - // let Sp3m = c.get(K::S3mh); - // let S1h = c.get(K::S1h); - // let g3n = c.get(K::G3); - // let SSCHLM = ZETA2 / 2 * (Sp1m - S1h + 2. / n) - S1 / n * *2 - g3 - 5 * ZETA3 / 8.; - // #[rustfmt::skip] - // let ggg1_caca = ( - // -4 * S1 * Sp2m - // - Sp3m - // + 8 * SSCHLM - // + 8 * Sp2m / (n * (n + 1)) - // + 2.0 - // * S1 - // * (72 + 144 * n + 67 * n**2 + 134 * n**3 + 67 * n**4) - // / (9 * n**2 * (n + 1) ** 2) - // - (144 + 258 * n + 7 * n**2 + 698 * n**3 + 469 * n**4 + 144 * n**5 + 48 * n**6) - // / (9 * n**3 * (1 + n) ** 3) - // ) * 0.5; - // #[rustfmt::skip] - // let ggg1_canf = ( - // -5 * S1 / 9 - // + (-3 + 13 * n + 16 * n**2 + 6 * n**3 + 3 * n**4) / (9 * n**2 * (1 + n) ** 2) - // ) * 4; - // #[rustfmt::skip] - // let ggg1_cfnf = (4 + 2 * n - 8 * n**2 + n**3 + 5 * n**4 + 3 * n**5 + n**6) / ( - // n**3 * (1 + n) ** 3 - // ); - // 4 * (CA * *2 * ggg1_caca + TR * nf * (CA * ggg1_canf + CF * ggg1_cfnf)) + let n = c.n(); + let S1 = c.get(K::S1); + let Sp1m = c.get(K::S1mh); + let Sp2m = c.get(K::S2mh); + let Sp3m = c.get(K::S3mh); + let S1h = c.get(K::S1h); + let g3 = c.get(K::G3); + let SSCHLM = ZETA2 / 2. * (Sp1m - S1h + 2. / n) - S1 / n.powu(2) - g3 - 5. * ZETA3 / 8.; + #[rustfmt::skip] + let ggg1_caca = ( + -4. * S1 * Sp2m + - Sp3m + + 8. * SSCHLM + + 8. * Sp2m / (n * (n + 1.)) + + 2.0 + * S1 + * (72. + 144. * n + 67. * n.powu(2) + 134. * n.powu(3) + 67. * n.powu(4)) + / (9. * n.powu(2) * (n + 1.).powu(2)) + - (144. + 258. * n + 7. * n.powu(2) + 698. * n.powu(3) + 469. * n.powu(4) + 144. * n.powu(5) + 48. * n.powu(6)) + / (9. * n.powu(3) * (1. + n).powu(3)) + ) * 0.5; + #[rustfmt::skip] + let ggg1_canf = ( + -5. * S1 / 9. + + (-3. + 13. * n + 16. * n.powu(2) + 6.* n.powu(3) + 3. * n.powu(4)) / (9. * n.powu(2) * (1. + n).powu(2)) + ) * 4.; + #[rustfmt::skip] + let ggg1_cfnf = (4. + 2. * n - 8. * n.powu(2) + n.powu(3) + 5. * n.powu(4) + 3. * n.powu(5) + n.powu(6)) / ( + n.powu(3) * (1. + n).powu(3) + ); + 4. * (CA * CA * ggg1_caca + TR * (nf as f64) * (CA * ggg1_canf + CF * ggg1_cfnf)) } /// Compute the singlet anomalous dimension matrix. @@ -146,10 +145,15 @@ mod tests { let mut c = Cache::new(cmplx!(1., 0.)); assert_approx_eq_cmplx!(f64, gamma_qg(&mut c, NF), Complex::zero(), epsilon = 2e-6); - // // qg momentum - // let mut c = Cache::new(cmplx!(1., 0.)); - // let gS1 = gamma_singlet(&mut c, NF); - // assert_approx_eq_cmplx!(f64, gS1[0][0], cmplx!(12. * TR * (NF as f64) * CF, 0.), epsilon = 1e-6); + // qg momentum + let mut c = Cache::new(cmplx!(1., 0.)); + let gS1 = gamma_singlet(&mut c, NF); + assert_approx_eq_cmplx!( + f64, + gS1[0][0], + cmplx!(12. * TR * (NF as f64) * CF, 0.), + epsilon = 2e-6 + ); } #[test] @@ -164,12 +168,18 @@ mod tests { -gamma_ps(&mut c, NF), cmplx!(-4.0 * CF * TR * (NF as f64) * 13. / 27.0, 0.) ); - // // qg - // assert_approx_eq_cmplx!( - // f64, - // gS1[0][1], - // cmplx!((-74.0 * CF - 35.0 * CA) * (NF as f64) / 27.0, 0.) - // ); + // qg + assert_approx_eq_cmplx!( + f64, + -gS1[0][1], + cmplx!( + 4. * (NF as f64) + * (0.574074074 * CF - 2. * CA * (-7. / 18. + 1. / 6. * (5. - PI.pow(2) / 3.))) + * TR, + 0. + ), + epsilon = 1e-9 + ); // gq assert_approx_eq_cmplx!( f64, From 02fffb96b66ac415bebc7939d492d95a8c7fb7ee Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 26 Sep 2024 19:22:54 +0300 Subject: [PATCH 7/8] rust: Drop leftover import --- crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs index 69144c17e..8dcdf6733 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs @@ -1,7 +1,6 @@ //! |NLO| |QCD|. use num::complex::Complex; -use num::Zero; use super::super::super::unpolarized::spacelike::as2::gamma_nsm as unpol_nsm; use super::super::super::unpolarized::spacelike::as2::gamma_nsp as unpol_nsp; From fcbdc92229f9208be49aa800c5d53bf187510181 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Mon, 7 Oct 2024 16:23:58 +0300 Subject: [PATCH 8/8] rust: Activate polarized ad --- .github/workflows/lha_bot_rust.yml | 11 +---------- crates/eko/src/lib.rs | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/lha_bot_rust.yml b/.github/workflows/lha_bot_rust.yml index 5de94c7e0..04d1293de 100644 --- a/.github/workflows/lha_bot_rust.yml +++ b/.github/workflows/lha_bot_rust.yml @@ -17,11 +17,6 @@ jobs: lhabench: name: LHA paper Benchmarks runs-on: ubuntu-latest - # container: - # image: ghcr.io/nnpdf/bench-evol:v2 - # credentials: - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: @@ -30,9 +25,6 @@ jobs: steps: - uses: actions/checkout@v2 - # with: - # # tags needed for dynamic versioning - # fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} 🐍 id: setup-python uses: actions/setup-python@v5 @@ -53,5 +45,4 @@ jobs: ./rustify.sh poe compile poe lha -m "nnlo and sv" - # TODO wait for polarized to reactivate - # poe lha -m "ffns_pol and sv" + poe lha -m "ffns_pol and sv" diff --git a/crates/eko/src/lib.rs b/crates/eko/src/lib.rs index 4e6347494..a6c5fa9ae 100644 --- a/crates/eko/src/lib.rs +++ b/crates/eko/src/lib.rs @@ -70,22 +70,21 @@ pub unsafe extern "C" fn rust_quad_ker_qcd(u: f64, rargs: *mut c_void) -> f64 { ); } } else if is_singlet { + let gamma_singlet_qcd = match args.is_polarized { + true => ekore::anomalous_dimensions::polarized::spacelike::gamma_singlet_qcd, + false => ekore::anomalous_dimensions::unpolarized::spacelike::gamma_singlet_qcd, + }; raw = unravel( - ekore::anomalous_dimensions::unpolarized::spacelike::gamma_singlet_qcd( - args.order_qcd, - &mut c, - args.nf, - ), + gamma_singlet_qcd(args.order_qcd, &mut c, args.nf), args.order_qcd, ); } else { // we can not do 1D - let res = ekore::anomalous_dimensions::unpolarized::spacelike::gamma_ns_qcd( - args.order_qcd, - args.mode0, - &mut c, - args.nf, - ); + let gamma_ns_qcd = match args.is_polarized { + true => ekore::anomalous_dimensions::polarized::spacelike::gamma_ns_qcd, + false => ekore::anomalous_dimensions::unpolarized::spacelike::gamma_ns_qcd, + }; + let res = gamma_ns_qcd(args.order_qcd, args.mode0, &mut c, args.nf); for el in res.iter().take(args.order_qcd) { raw.re.push(el.re); raw.im.push(el.im);