From 38fc97d8333d94a0fc1660c7579a658e4658d6f0 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 30 Aug 2024 11:27:50 +0200 Subject: [PATCH] Do not evolve the same Q2 slice more than once --- pineappl/src/evolution.rs | 2 +- pineappl/src/grid.rs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pineappl/src/evolution.rs b/pineappl/src/evolution.rs index cefcc209..83e57c3d 100644 --- a/pineappl/src/evolution.rs +++ b/pineappl/src/evolution.rs @@ -16,7 +16,7 @@ use ndarray::{s, Array1, Array2, Array3, ArrayView1, ArrayView4, Axis}; use std::iter; /// Number of ULPS used to de-duplicate grid values in [`Grid::evolve_info`]. -pub(crate) const EVOLVE_INFO_TOL_ULPS: i64 = 64; +pub(crate) const EVOLVE_INFO_TOL_ULPS: i64 = 256; /// Number of ULPS used to search for grid values in this module. This value must be a large-enough /// multiple of [`EVOLVE_INFO_TOL_ULPS`], because otherwise similar values are not found in diff --git a/pineappl/src/grid.rs b/pineappl/src/grid.rs index 113d1908..c99620a0 100644 --- a/pineappl/src/grid.rs +++ b/pineappl/src/grid.rs @@ -1418,6 +1418,15 @@ impl Grid { op_fac1.push(info.fac1); + // it's possible that due to small numerical differences we get two slices which are + // almost the same. We have to skip those in order not to evolve the 'same' slice twice + if used_op_fac1 + .iter() + .any(|&fac| approx_eq!(f64, fac, info.fac1, ulps = EVOLVE_INFO_TOL_ULPS)) + { + continue; + } + // skip slices that the grid doesn't use if !grid_fac1 .iter() @@ -1543,6 +1552,15 @@ impl Grid { op_fac1.push(info_a.fac1); + // it's possible that due to small numerical differences we get two slices which are + // almost the same. We have to skip those in order not to evolve the 'same' slice twice + if used_op_fac1 + .iter() + .any(|&fac| approx_eq!(f64, fac, info_a.fac1, ulps = EVOLVE_INFO_TOL_ULPS)) + { + continue; + } + // skip slices that the grid doesn't use if !grid_fac1 .iter()