Skip to content

Commit

Permalink
Skip unused Q2 slices in the evolution
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Aug 30, 2024
1 parent 5db50eb commit 7085e51
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,9 @@ impl Grid {
use super::evolution::EVOLVE_INFO_TOL_ULPS;

let mut lhs: Option<Self> = None;
// Q2 slices we use
let mut used_op_fac1 = Vec::new();
// Q2 slices we encounter, but possibly don't use
let mut op_fac1 = Vec::new();
// Q2 slices needed by the grid
let grid_fac1: Vec<_> = self
Expand All @@ -1415,6 +1418,14 @@ impl Grid {

op_fac1.push(info.fac1);

// skip slices that the grid doesn't use
if !grid_fac1
.iter()
.any(|&fac| approx_eq!(f64, fac, info.fac1, ulps = EVOLVE_INFO_TOL_ULPS))
{
continue;
}

let op_info_dim = (
info.pids1.len(),
info.x1.len(),
Expand Down Expand Up @@ -1457,14 +1468,16 @@ impl Grid {
} else {
lhs = Some(rhs);
}

used_op_fac1.push(info.fac1);
}

// UNWRAP: if we can't compare two numbers there's a bug
op_fac1.sort_by(|a, b| a.partial_cmp(b).unwrap_or_else(|| unreachable!()));

// make sure we've evolved all slices
if let Some(muf2) = grid_fac1.into_iter().find(|&grid_mu2| {
!op_fac1
!used_op_fac1
.iter()
.any(|&eko_mu2| approx_eq!(f64, grid_mu2, eko_mu2, ulps = EVOLVE_INFO_TOL_ULPS))
}) {
Expand Down Expand Up @@ -1503,6 +1516,9 @@ impl Grid {
use itertools::izip;

let mut lhs: Option<Self> = None;
// Q2 slices we use
let mut used_op_fac1 = Vec::new();
// Q2 slices we encounter, but possibly don't use
let mut op_fac1 = Vec::new();
// Q2 slices needed by the grid
let grid_fac1: Vec<_> = self
Expand All @@ -1527,6 +1543,14 @@ impl Grid {

op_fac1.push(info_a.fac1);

// skip slices that the grid doesn't use
if !grid_fac1
.iter()
.any(|&fac| approx_eq!(f64, fac, info_a.fac1, ulps = EVOLVE_INFO_TOL_ULPS))
{
continue;
}

let op_info_dim_a = (
info_a.pids1.len(),
info_a.x1.len(),
Expand Down Expand Up @@ -1599,14 +1623,16 @@ impl Grid {
} else {
lhs = Some(rhs);
}

used_op_fac1.push(infos[0].fac1);
}

// UNWRAP: if we can't compare two numbers there's a bug
op_fac1.sort_by(|a, b| a.partial_cmp(b).unwrap_or_else(|| unreachable!()));

// make sure we've evolved all slices
if let Some(muf2) = grid_fac1.into_iter().find(|&grid_mu2| {
!op_fac1
!used_op_fac1
.iter()
.any(|&eko_mu2| approx_eq!(f64, grid_mu2, eko_mu2, ulps = EVOLVE_INFO_TOL_ULPS))
}) {
Expand Down

0 comments on commit 7085e51

Please sign in to comment.