Skip to content

Commit

Permalink
add struct for charge combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiani committed Oct 21, 2024
1 parent a40908b commit f0edfae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
28 changes: 10 additions & 18 deletions crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/aem1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ 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 e2avg = cc[0];
let vue2m = cc[1];
let vde2m = cc[2];
let e2delta = cc[3];

let gamma_ph_q = gamma_phq(c, nf);
let gamma_q_ph = gamma_qph(c, nf);
Expand All @@ -61,20 +57,20 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 4]; 4] {
[
Complex::<f64>::zero(),
gamma_phph(c, nf),
e2avg * gamma_ph_q,
vue2m * gamma_ph_q,
cc.e2avg * gamma_ph_q,
cc.vue2m * gamma_ph_q,
],
[
Complex::<f64>::zero(),
e2avg * gamma_q_ph,
e2avg * gamma_nonsinglet,
vue2m * gamma_nonsinglet,
cc.e2avg * gamma_q_ph,
cc.e2avg * gamma_nonsinglet,
cc.vue2m * gamma_nonsinglet,
],
[
Complex::<f64>::zero(),
vde2m * gamma_q_ph,
vde2m * gamma_nonsinglet,
e2delta * gamma_nonsinglet,
cc.vde2m * gamma_q_ph,
cc.vde2m * gamma_nonsinglet,
cc.e2delta * gamma_nonsinglet,
],
]
}
Expand All @@ -84,14 +80,10 @@ 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 e2avg = cc[0];
let vue2m = cc[1];
let vde2m = cc[2];
let e2delta = cc[3];

[
[e2avg * gamma_ns(c, nf), vue2m * gamma_ns(c, nf)],
[vde2m * gamma_ns(c, nf), 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
17 changes: 15 additions & 2 deletions crates/ekore/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,25 @@ pub fn uplike_flavors(nf: u8) -> u8 {
nf / 2
}

pub fn charge_combinations(nf: u8) -> Vec<f64> {
pub struct ChargeCombinations {
pub e2avg: f64,
pub vue2m: f64,
pub vde2m: f64,
pub e2delta: f64,
}

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;
vec![e2avg, vue2m, vde2m, e2delta]

ChargeCombinations {
e2avg,
vue2m,
vde2m,
e2delta,
}
}

0 comments on commit f0edfae

Please sign in to comment.