-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #406 from NNPDF/rust-pol
Rustify ad.p.s.{as1,as2}
- Loading branch information
Showing
7 changed files
with
352 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//! The anomalous dimensions for |DGLAP| evolution. | ||
pub mod polarized; | ||
pub mod unpolarized; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//! The polarized anomalous dimensions for space-like kinematics. | ||
pub mod spacelike; |
57 changes: 57 additions & 0 deletions
57
crates/ekore/src/anomalous_dimensions/polarized/spacelike.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Complex<f64>> { | ||
let mut gamma_ns = vec![Complex::<f64>::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<f64>; 2]; 2]> { | ||
let mut gamma_S = vec![ | ||
[ | ||
[Complex::<f64>::zero(), Complex::<f64>::zero()], | ||
[Complex::<f64>::zero(), Complex::<f64>::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 | ||
} |
85 changes: 85 additions & 0 deletions
85
crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
//! |LO| |QCD|. | ||
use num::complex::Complex; | ||
|
||
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<f64> { | ||
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<f64> { | ||
let N = c.n(); | ||
let gamma = -(N - 1.) / N / (N + 1.); | ||
2.0 * TR * 2.0 * (nf as f64) * 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<f64> { | ||
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<f64> { | ||
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 as f64) | ||
} | ||
|
||
/// Compute the singlet anomalous dimension matrix. | ||
pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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<f64> = 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, cmplx!((4. * CF) / 3., 0.), epsilon = 1e-12); | ||
} | ||
|
||
#[test] | ||
fn gluon_momentum_conservation() { | ||
const N: Complex<f64> = 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, cmplx!(3. + (NF as f64) / 3., 0.), epsilon = 1e-12); | ||
} | ||
|
||
#[test] | ||
fn qg_helicity_conservation() { | ||
const N: Complex<f64> = 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); | ||
} | ||
} |
Oops, something went wrong.