Skip to content

Commit

Permalink
use Vec<> only when dimension is not known, else use normal list
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiani committed Nov 20, 2024
1 parent b0f6722 commit e4c621b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
22 changes: 9 additions & 13 deletions crates/ekore/src/anomalous_dimensions/unpolarized/spacelike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,19 @@ pub fn choose_ns_as_as1aem1(mode: u16, c: &mut Cache, nf: u8) -> Complex<f64> {
}
}

/// 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<Vec<Vec<[Complex<f64>; 4]>>> {
) -> Vec<Vec<[[Complex<f64>; 4]; 4]>> {
let row = vec![
vec![
[
Complex::<f64>::zero(),
Complex::<f64>::zero(),
Complex::<f64>::zero(),
Complex::<f64>::zero()
];
4
];
[[
Complex::<f64>::zero(),
Complex::<f64>::zero(),
Complex::<f64>::zero(),
Complex::<f64>::zero()
]; 4];
order_qcd + 1
];

Expand All @@ -128,8 +124,8 @@ pub fn gamma_valence_qed(
order_qed: usize,
c: &mut Cache,
nf: u8,
) -> Vec<Vec<Vec<[Complex<f64>; 2]>>> {
let row = vec![vec![[Complex::<f64>::zero(), Complex::<f64>::zero(),]; 2]; order_qcd + 1];
) -> Vec<Vec<[[Complex<f64>; 2]; 2]>> {
let row = vec![[[Complex::<f64>::zero(), Complex::<f64>::zero(),]; 2]; order_qcd + 1];

let mut gamma_v = vec![row; order_qed + 1];
gamma_v[1][0] = as1::gamma_valence_qed(c, nf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ pub fn gamma_ns(c: &mut Cache, nf: u8) -> Complex<f64> {
/// 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<f64>; 4]> {
pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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::<f64>::zero(),
Complex::<f64>::zero(),
Expand Down Expand Up @@ -78,10 +78,10 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex<f64>; 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<f64>; 2]> {
pub fn gamma_valence(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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)],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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<f64>; 4]> {
vec![
pub fn gamma_singlet_qed(c: &mut Cache, nf: u8) -> [[Complex<f64>; 4]; 4] {
[
[
gamma_gg(c, nf),
Complex::<f64>::zero(),
Expand Down Expand Up @@ -86,8 +86,8 @@ pub fn gamma_singlet_qed(c: &mut Cache, nf: u8) -> Vec<[Complex<f64>; 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<f64>; 2]> {
vec![
pub fn gamma_valence_qed(c: &mut Cache, nf: u8) -> [[Complex<f64>; 2]; 2] {
[
[gamma_ns(c, nf), Complex::<f64>::zero()],
[Complex::<f64>::zero(), gamma_ns(c, nf)],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ pub fn gamma_nsm(c: &mut Cache, _nf: u8) -> Complex<f64> {
}

/// Compute the $O(a_s^1a_{em}^1)$ singlet sector.
pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex<f64>; 4]> {
pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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),
Expand Down Expand Up @@ -228,9 +228,9 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> Vec<[Complex<f64>; 4]> {
}

/// Compute the $O(a_s^1a_{em}^1)$ valence sector.
pub fn gamma_valence(c: &mut Cache, nf: u8) -> Vec<[Complex<f64>; 2]> {
pub fn gamma_valence(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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),
Expand Down

0 comments on commit e4c621b

Please sign in to comment.