Skip to content

Commit

Permalink
rewrite ChargeCombination struct
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiani committed Nov 11, 2024
1 parent 7c160f1 commit 37a65e8
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 30 deletions.
26 changes: 13 additions & 13 deletions crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/aem1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use num::complex::Complex;
use num::Zero;

use crate::constants::{charge_combinations, ed2, eu2, uplike_flavors, CF, NC, TR};
use crate::constants::{ed2, eu2, uplike_flavors, ChargeCombinations, CF, NC, TR};
use crate::harmonics::cache::Cache;

use crate::anomalous_dimensions::unpolarized::spacelike::as1;
Expand Down Expand Up @@ -41,7 +41,7 @@ pub fn gamma_ns(c: &mut Cache, nf: u8) -> Complex<f64> {
///
/// Implements Eq. (2.5) of
pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 4]; 4] {
let cc = charge_combinations(nf);
let cc = ChargeCombinations { nf };

let gamma_ph_q = gamma_phq(c, nf);
let gamma_q_ph = gamma_qph(c, nf);
Expand All @@ -57,20 +57,20 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 4]; 4] {
[
Complex::<f64>::zero(),
gamma_phph(c, nf),
cc.e2avg * gamma_ph_q,
cc.vue2m * gamma_ph_q,
cc.e2avg() * gamma_ph_q,
cc.vue2m() * gamma_ph_q,
],
[
Complex::<f64>::zero(),
cc.e2avg * gamma_q_ph,
cc.e2avg * gamma_nonsinglet,
cc.vue2m * gamma_nonsinglet,
cc.e2avg() * gamma_q_ph,
cc.e2avg() * gamma_nonsinglet,
cc.vue2m() * gamma_nonsinglet,
],
[
Complex::<f64>::zero(),
cc.vde2m * gamma_q_ph,
cc.vde2m * gamma_nonsinglet,
cc.e2delta * gamma_nonsinglet,
cc.vde2m() * gamma_q_ph,
cc.vde2m() * gamma_nonsinglet,
cc.e2delta() * gamma_nonsinglet,
],
]
}
Expand All @@ -79,11 +79,11 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 4]; 4] {
///
/// Implements Eq. (2.5) of
pub fn gamma_valence(c: &mut Cache, nf: u8) -> [[Complex<f64>; 2]; 2] {
let cc = charge_combinations(nf);
let cc = ChargeCombinations { nf };

[
[cc.e2avg * gamma_ns(c, nf), cc.vue2m * gamma_ns(c, nf)],
[cc.vde2m * gamma_ns(c, nf), cc.e2delta * gamma_ns(c, nf)],
[cc.e2avg() * gamma_ns(c, nf), cc.vue2m() * gamma_ns(c, nf)],
[cc.vde2m() * gamma_ns(c, nf), cc.e2delta() * gamma_ns(c, nf)],
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub fn gamma_nsp(c: &mut Cache, _nf: u8) -> Complex<f64> {
let S1p1h = c.get(K::S1ph);
let S2p1h = c.get(K::S2ph);
let S3p1h = c.get(K::S3ph);

let g3N = c.get(K::G3);
let g3Np2 = c.get(K::G3p2);

Expand All @@ -140,3 +141,53 @@ pub fn gamma_nsp(c: &mut Cache, _nf: u8) -> Complex<f64> {

CF * result
}

/// Compute the $O(a_s^1a_{em}^1)$ valence-like non singlet anomalous dimension.
///
/// Implements Eqs. (33-34) of
pub fn gamma_nsm(c: &mut Cache, _nf: u8) -> Complex<f64> {
let N = c.n();
let S1 = c.get(K::S1);
let S2 = c.get(K::S2);
let S3 = c.get(K::S3);
let S1h = c.get(K::S1h);
let S2h = c.get(K::S2h);
let S3h = c.get(K::S3h);
let S1p1h = c.get(K::S1ph);
let S2p1h = c.get(K::S2ph);
let S3p1h = c.get(K::S3ph);
let g3N = c.get(K::G3);
let g3Np2 = c.get(K::G3p2);

#[rustfmt::skip]
let result =
-32.0 * ZETA2 * S1h
- 8.0 / (N + N.powu(2)) * S2h
+ (24.0 + 16.0 / (N + N.powu(2))) * S2
+ 8.0 / (N + N.powu(2)) * S2p1h
+ S1
* (
16.0 * (-1.0 / N.powu(2) + 1.0 / (1.0 + N).powu(2) + 2.0 * ZETA2)
+ 16.0 * S2h
- 32.0 * S2
- 16.0 * S2p1h
)
+ (
72.0
+ N
* (
96.0
- 3.0 * N * (8.0 + 3.0 * N * (3.0 + N) * (3.0 + N.powu(2)))
+ 48.0 * N * (1.0 + N).powu(2) * ZETA2
)
)
/ (3.0 * N.powu(3) * (1.0 + N).powu(3))
- 32.0 * (g3N + g3Np2)
+ 32.0 * ZETA2 * S1p1h
+ 4.0 * S3h
- 32.0 * S3
- 4.0 * S3p1h
- 16.0 * ZETA3;

CF * result
}
41 changes: 24 additions & 17 deletions crates/ekore/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,31 @@ pub fn uplike_flavors(nf: u8) -> u8 {
}

pub struct ChargeCombinations {
pub e2avg: f64,
pub vue2m: f64,
pub vde2m: f64,
pub e2delta: f64,
pub nf: u8,
}

pub fn charge_combinations(nf: u8) -> ChargeCombinations {
let nu = uplike_flavors(nf) as f64;
let nd = (nf as f64) - nu;
let e2avg = (nu * eu2 + nd * ed2) / (nf as f64);
let vue2m = nu / (nf as f64) * (eu2 - ed2);
let vde2m = nd / (nf as f64) * (eu2 - ed2);
let e2delta = vde2m - vue2m + e2avg;

ChargeCombinations {
e2avg,
vue2m,
vde2m,
e2delta,
impl ChargeCombinations {
pub fn nu(&self) -> u8 {
uplike_flavors(self.nf)
}

pub fn nd(&self) -> u8 {
self.nf - self.nu()
}

pub fn e2avg(&self) -> f64 {
(self.nu() as f64 * eu2 + self.nd() as f64 * ed2) / (self.nf as f64)
}

pub fn vue2m(&self) -> f64 {
self.nu() as f64 / (self.nf as f64) * (eu2 - ed2)
}

pub fn vde2m(&self) -> f64 {
self.nd() as f64 / (self.nf as f64) * (eu2 - ed2)
}

pub fn e2delta(&self) -> f64 {
self.vde2m() - self.vue2m() + self.e2avg()
}
}

0 comments on commit 37a65e8

Please sign in to comment.