From e4c621b4dbdeea576bdc77c510d76f342aa318ba Mon Sep 17 00:00:00 2001 From: tgiani Date: Wed, 20 Nov 2024 17:25:44 +0100 Subject: [PATCH] use Vec<> only when dimension is not known, else use normal list --- .../unpolarized/spacelike.rs | 22 ++++++++----------- .../unpolarized/spacelike/aem1.rs | 8 +++---- .../unpolarized/spacelike/as1.rs | 8 +++---- .../unpolarized/spacelike/as1aem1.rs | 8 +++---- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike.rs b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike.rs index 5d50ca6b5..810e004a9 100644 --- a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike.rs +++ b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike.rs @@ -94,23 +94,19 @@ pub fn choose_ns_as_as1aem1(mode: u16, c: &mut Cache, nf: u8) -> Complex { } } -/// Compute the grid of the QED singlet anomalous dimensions matrices pub fn gamma_singlet_qed( order_qcd: usize, order_qed: usize, c: &mut Cache, nf: u8, -) -> Vec; 4]>>> { +) -> Vec; 4]; 4]>> { let row = vec![ - vec![ - [ - Complex::::zero(), - Complex::::zero(), - Complex::::zero(), - Complex::::zero() - ]; - 4 - ]; + [[ + Complex::::zero(), + Complex::::zero(), + Complex::::zero(), + Complex::::zero() + ]; 4]; order_qcd + 1 ]; @@ -128,8 +124,8 @@ pub fn gamma_valence_qed( order_qed: usize, c: &mut Cache, nf: u8, -) -> Vec; 2]>>> { - let row = vec![vec![[Complex::::zero(), Complex::::zero(),]; 2]; order_qcd + 1]; +) -> Vec; 2]; 2]>> { + let row = vec![[[Complex::::zero(), Complex::::zero(),]; 2]; order_qcd + 1]; let mut gamma_v = vec![row; order_qed + 1]; gamma_v[1][0] = as1::gamma_valence_qed(c, nf); diff --git a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/aem1.rs b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/aem1.rs index ded4825d7..bc70ed97f 100644 --- a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/aem1.rs +++ b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/aem1.rs @@ -40,14 +40,14 @@ pub fn gamma_ns(c: &mut Cache, nf: u8) -> Complex { /// Compute the leading-order singlet QED anomalous dimension matrix /// /// Implements Eq. (2.5) of -pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex; 4]> { +pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex; 4]; 4] { let cc = ChargeCombinations { nf }; let gamma_ph_q = gamma_phq(c, nf); let gamma_q_ph = gamma_qph(c, nf); let gamma_nonsinglet = gamma_ns(c, nf); - vec![ + [ [ Complex::::zero(), Complex::::zero(), @@ -78,10 +78,10 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex; 4]> { /// Compute the leading-order valence QED anomalous dimension matrix /// /// Implements Eq. (2.5) of -pub fn gamma_valence(c: &mut Cache, nf: u8) -> Vec<[Complex; 2]> { +pub fn gamma_valence(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { let cc = ChargeCombinations { nf }; - vec![ + [ [cc.e2avg() * gamma_ns(c, nf), cc.vue2m() * gamma_ns(c, nf)], [cc.vde2m() * gamma_ns(c, nf), cc.e2delta() * gamma_ns(c, nf)], ] diff --git a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1.rs b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1.rs index 8075804de..bd2c67045 100644 --- a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1.rs +++ b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1.rs @@ -55,8 +55,8 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { /// Compute the leading-order singlet anomalous dimension matrix /// for the unified evolution basis. -pub fn gamma_singlet_qed(c: &mut Cache, nf: u8) -> Vec<[Complex; 4]> { - vec![ +pub fn gamma_singlet_qed(c: &mut Cache, nf: u8) -> [[Complex; 4]; 4] { + [ [ gamma_gg(c, nf), Complex::::zero(), @@ -86,8 +86,8 @@ pub fn gamma_singlet_qed(c: &mut Cache, nf: u8) -> Vec<[Complex; 4]> { /// Compute the leading-order valence anomalous dimension matrix /// for the unified evolution basis. -pub fn gamma_valence_qed(c: &mut Cache, nf: u8) -> Vec<[Complex; 2]> { - vec![ +pub fn gamma_valence_qed(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { + [ [gamma_ns(c, nf), Complex::::zero()], [Complex::::zero(), gamma_ns(c, nf)], ] diff --git a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs index a7ee20db9..546acca85 100644 --- a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs +++ b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as1aem1.rs @@ -195,11 +195,11 @@ pub fn gamma_nsm(c: &mut Cache, _nf: u8) -> Complex { } /// Compute the $O(a_s^1a_{em}^1)$ singlet sector. -pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex; 4]> { +pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex; 4]; 4] { let cc = ChargeCombinations { nf }; let e2_tot = nf as f64 * cc.e2avg(); - vec![ + [ [ e2_tot * gamma_gg(c, nf), e2_tot * gamma_gph(c, nf), @@ -228,9 +228,9 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex; 4]> { } /// Compute the $O(a_s^1a_{em}^1)$ valence sector. -pub fn gamma_valence(c: &mut Cache, nf: u8) -> Vec<[Complex; 2]> { +pub fn gamma_valence(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { let cc = ChargeCombinations { nf }; - vec![ + [ [cc.e2avg() * gamma_nsm(c, nf), cc.vue2m() * gamma_nsm(c, nf)], [ cc.vde2m() * gamma_nsm(c, nf) * gamma_nsm(c, nf),