From 1514f7a527a7eed6bc0b9f66e22dfc84effddff2 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 12:11:34 +0100 Subject: [PATCH 01/18] replace newton method by analytic solution. --- pineappl/Cargo.toml | 1 + pineappl/src/interpolation.rs | 18 +++--------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/pineappl/Cargo.toml b/pineappl/Cargo.toml index 6d2622643..a1f86f204 100644 --- a/pineappl/Cargo.toml +++ b/pineappl/Cargo.toml @@ -32,6 +32,7 @@ rayon = "1.5.1" rustc-hash = "1.1.0" serde = { features = ["derive"], version = "1.0.130" } thiserror = "1.0.30" +lambert_w = "1.2.31" [dev-dependencies] lhapdf = { package = "managed-lhapdf", version = "0.3.4" } diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index 02211279f..afd95079e 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -16,21 +16,9 @@ mod applgrid { } pub fn fx2(y: f64) -> f64 { - let mut yp = y; - let mut deltap = f64::INFINITY; - - for _ in 0..10 { - let x = (-yp).exp(); - let delta = (1.0 - x).mul_add(-5.0, y - yp); - if (delta.abs() < 1e-15) && (delta >= deltap) { - return x; - } - let deriv = x.mul_add(-5.0, -1.0); - yp -= delta / deriv; - deltap = delta; - } - - unreachable!(); + let z = -5.0 * (-y).exp(); + let w = lambert_w::lambert_w0(z); + return -w / 5.0; } pub fn fy2(x: f64) -> f64 { From ae581b68b995257d32d28347ca1efc0245638d12 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 12:58:09 +0100 Subject: [PATCH 02/18] fix factor of 5 --- pineappl/src/interpolation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index afd95079e..bb43da09e 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -16,7 +16,7 @@ mod applgrid { } pub fn fx2(y: f64) -> f64 { - let z = -5.0 * (-y).exp(); + let z = -5.0 * (5-y).exp(); let w = lambert_w::lambert_w0(z); return -w / 5.0; } From ca7e5d881780932bfcf38660c70b3bd67b2d769a Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 13:02:30 +0100 Subject: [PATCH 03/18] use floating point for 5. --- pineappl/src/interpolation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index bb43da09e..4f2197444 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -16,7 +16,7 @@ mod applgrid { } pub fn fx2(y: f64) -> f64 { - let z = -5.0 * (5-y).exp(); + let z = -5.0 * (5.0-y).exp(); let w = lambert_w::lambert_w0(z); return -w / 5.0; } From ba2d689f5b4ab0f0ad4e2fa6390bd70f3573efef Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 14:10:20 +0100 Subject: [PATCH 04/18] fix signs --- pineappl/src/interpolation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index 4f2197444..d68eb32ed 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -16,9 +16,9 @@ mod applgrid { } pub fn fx2(y: f64) -> f64 { - let z = -5.0 * (5.0-y).exp(); + let z = 5.0 * (5.0-y).exp(); let w = lambert_w::lambert_w0(z); - return -w / 5.0; + return w / 5.0; } pub fn fy2(x: f64) -> f64 { From 78e3d90311441a0064ec3fa4bace142a695526a8 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 14:24:29 +0100 Subject: [PATCH 05/18] adapt last digits in get-subgrids example to match result from changed function in interpolation. --- examples/cpp/get-subgrids.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/cpp/get-subgrids.cpp b/examples/cpp/get-subgrids.cpp index 5cd1385de..e7b818dcc 100644 --- a/examples/cpp/get-subgrids.cpp +++ b/examples/cpp/get-subgrids.cpp @@ -136,11 +136,11 @@ int main() { // Check the values of the node entries. assert(node_values_index[0] == 5442.30542919352900); // PyAPI: `subgrid.node_values[0][16]` - assert(node_values_index[1] == 0.03052158400782889); // PyAPI: `subgrid.node_values[1][20]` - assert(node_values_index[2] == 0.03052158400782889); // PyAPI: `subgrid.node_values[2][20]` + assert(node_values_index[1] == 0.030521584007828874); // PyAPI: `subgrid.node_values[1][20]` + assert(node_values_index[2] == 0.030521584007828874); // PyAPI: `subgrid.node_values[2][20]` // PyAPI: `grid.subgrid(0, 0, 0).to_array(subgrid.shape)[16][20][20]` - assert(subgrid_array[index] == -4.936156925096015e-07); + assert(subgrid_array[index] == -4.9361569250960126e-07); } break; } From 200ee07e78df5e1e47706c38d28c76d82a095452 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 14:38:45 +0100 Subject: [PATCH 06/18] Update output from lhapdf_example in the fortran examples. --- examples/fortran/lhapdf_example.output | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/fortran/lhapdf_example.output b/examples/fortran/lhapdf_example.output index 8a35b276a..8f8ef4a8c 100644 --- a/examples/fortran/lhapdf_example.output +++ b/examples/fortran/lhapdf_example.output @@ -1,6 +1,6 @@ Computing predictions with the same PDF: NNPDF31_nlo_as_0118_luxqed - 7.1330573367785985E-005 2.1399172010335785E-004 + 7.1330573367786162E-005 2.1399172010335844E-004 Computing predictions with different PDFs and alphasQ2(NNPDF31_nlo_as_0118_luxqed): - 7.3091433321743418E-005 2.1927429996523019E-004 + 7.3091433321743459E-005 2.1927429996523032E-004 Computing predictions with different PDFs and alphasQ2(MSHT20qed_nnlo): - 7.3462246623863024E-005 2.2038673987158908E-004 + 7.3462246623863092E-005 2.2038673987158919E-004 From 615fcd10ec3d3b198f17d31ce0f89e22f33a292f Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 16:17:32 +0100 Subject: [PATCH 07/18] Relax the tolerance for some checks. --- pineappl/src/interpolation.rs | 2 +- pineappl/src/subgrid.rs | 2 +- pineappl/tests/drell_yan_lo.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index d68eb32ed..26d78e28f 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -477,7 +477,7 @@ mod tests { assert_eq!(node_values[2].len(), interps[2].nodes()); for (&node, ref_node) in node_values[1].iter().zip(x_reference) { - assert_approx_eq!(f64, node, ref_node, ulps = 4); + assert_approx_eq!(f64, node, ref_node, ulps = 8); } for (&node, ref_node) in node_values[2].iter().zip(x_reference) { diff --git a/pineappl/src/subgrid.rs b/pineappl/src/subgrid.rs index c09968de6..02654436c 100644 --- a/pineappl/src/subgrid.rs +++ b/pineappl/src/subgrid.rs @@ -11,7 +11,7 @@ use std::{iter, mem}; /// TODO #[must_use] pub fn node_value_eq(lhs: f64, rhs: f64) -> bool { - approx_eq!(f64, lhs, rhs, ulps = 4096) + approx_eq!(f64, lhs, rhs, epsilon = 1e-15) } /// TODO diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index 47669bd7c..c4bdb8d60 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, ulps = 4); + assert_approx_eq!(f64, *result, *reference, ulps = 8); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` From 3ecea2c1fb693c842a4a3e2958c7e01627021cde Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 16:40:43 +0100 Subject: [PATCH 08/18] Set epsilon to 1e-15 in interpolation and drell-yan-lo checks. --- pineappl/src/interpolation.rs | 2 +- pineappl/tests/drell_yan_lo.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index 26d78e28f..f67e9eda5 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -477,7 +477,7 @@ mod tests { assert_eq!(node_values[2].len(), interps[2].nodes()); for (&node, ref_node) in node_values[1].iter().zip(x_reference) { - assert_approx_eq!(f64, node, ref_node, ulps = 8); + assert_approx_eq!(f64, node, ref_node, epsilon = 1e-15); } for (&node, ref_node) in node_values[2].iter().zip(x_reference) { diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index c4bdb8d60..a3363102e 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, ulps = 8); + assert_approx_eq!(f64, *result, *reference, epsilon 1e-15); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` From 7c55632d25aff9f8f2a9c9a48c2172976b7031ff Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 16:45:43 +0100 Subject: [PATCH 09/18] Fix = sign in drell-yan-lo.rs --- pineappl/tests/drell_yan_lo.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index a3363102e..edc973f57 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, epsilon 1e-15); + assert_approx_eq!(f64, *result, *reference, epsilon = 1e-15); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` From 2a172489455daf8eae043fd27e613e92781616cb Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 16:59:31 +0100 Subject: [PATCH 10/18] try to run checks on laptop --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0f9e75287..f0316f41b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted container: ghcr.io/nnpdf/pineappl-ci:latest steps: - uses: actions/checkout@v4 From d6696e982c19489dd44e86e87d4ba0b44e4f2583 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 17:13:22 +0100 Subject: [PATCH 11/18] Revert "try to run checks on laptop" This reverts commit 2a172489455daf8eae043fd27e613e92781616cb. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f0316f41b..0f9e75287 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ env: jobs: build: - runs-on: self-hosted + runs-on: ubuntu-latest container: ghcr.io/nnpdf/pineappl-ci:latest steps: - uses: actions/checkout@v4 From 1165de65ea74bf64a3d48230f3272914c7d4f3d7 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 17:17:22 +0100 Subject: [PATCH 12/18] set epsilon to 1e-12. --- pineappl/src/interpolation.rs | 2 +- pineappl/src/subgrid.rs | 2 +- pineappl/tests/drell_yan_lo.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index f67e9eda5..9b35dc6ba 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -477,7 +477,7 @@ mod tests { assert_eq!(node_values[2].len(), interps[2].nodes()); for (&node, ref_node) in node_values[1].iter().zip(x_reference) { - assert_approx_eq!(f64, node, ref_node, epsilon = 1e-15); + assert_approx_eq!(f64, node, ref_node, epsilon = 1e-12); } for (&node, ref_node) in node_values[2].iter().zip(x_reference) { diff --git a/pineappl/src/subgrid.rs b/pineappl/src/subgrid.rs index 02654436c..04381c3b0 100644 --- a/pineappl/src/subgrid.rs +++ b/pineappl/src/subgrid.rs @@ -11,7 +11,7 @@ use std::{iter, mem}; /// TODO #[must_use] pub fn node_value_eq(lhs: f64, rhs: f64) -> bool { - approx_eq!(f64, lhs, rhs, epsilon = 1e-15) + approx_eq!(f64, lhs, rhs, epsilon = 1e-12) } /// TODO diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index edc973f57..dcb91ac95 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, epsilon = 1e-15); + assert_approx_eq!(f64, *result, *reference, epsilon = 1e-12); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` From f5ec260ecf944f52f8cf2d52f02c556b16460ed9 Mon Sep 17 00:00:00 2001 From: peterkrack Date: Tue, 18 Nov 2025 17:23:28 +0100 Subject: [PATCH 13/18] relax another check in interpolation.rs. --- pineappl/src/interpolation.rs | 2 +- pineappl/tests/drell_yan_lo.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index 9b35dc6ba..771c912a8 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -481,7 +481,7 @@ mod tests { } for (&node, ref_node) in node_values[2].iter().zip(x_reference) { - assert_approx_eq!(f64, node, ref_node, ulps = 4); + assert_approx_eq!(f64, node, ref_node, epsilon = 1e-12); } let mut array = crate::packed_array::PackedArray::::new(vec![40, 50, 50]); diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index dcb91ac95..47e46492f 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, epsilon = 1e-12); + assert_approx_eq!(f64, *result, *reference, epsilon = 1e-10); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` From 92d4384097fc9b589e5c3824c356925a3a2c0edd Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 19 Nov 2025 17:41:58 +0100 Subject: [PATCH 14/18] Add regression test for PR 365 --- pineappl/src/interpolation.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index 771c912a8..f67cbdad1 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -742,4 +742,20 @@ mod tests { assert!(applgrid::fq20(applgrid::ftau0(q2)).ulps(&q2) < 4); } } + + #[test] + fn pr_365() { + assert_approx_eq!( + f64, + applgrid::fx2(6.7865509745), + 0.1010727499933246, + ulps = 4 + ); + assert_approx_eq!( + f64, + applgrid::fx2(6.786550974400577), + 0.10107275000000002, + ulps = 4 + ); + } } From f8677a097c78d6dc388a1b6663f4a77947c1523b Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 20 Nov 2025 19:02:28 +0100 Subject: [PATCH 15/18] Revert commits to again use Newton iteration --- examples/cpp/get-subgrids.cpp | 6 +++--- examples/fortran/lhapdf_example.output | 6 +++--- pineappl/Cargo.toml | 1 - pineappl/src/interpolation.rs | 22 +++++++++++++++++----- pineappl/src/subgrid.rs | 2 +- pineappl/tests/drell_yan_lo.rs | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/examples/cpp/get-subgrids.cpp b/examples/cpp/get-subgrids.cpp index e7b818dcc..5cd1385de 100644 --- a/examples/cpp/get-subgrids.cpp +++ b/examples/cpp/get-subgrids.cpp @@ -136,11 +136,11 @@ int main() { // Check the values of the node entries. assert(node_values_index[0] == 5442.30542919352900); // PyAPI: `subgrid.node_values[0][16]` - assert(node_values_index[1] == 0.030521584007828874); // PyAPI: `subgrid.node_values[1][20]` - assert(node_values_index[2] == 0.030521584007828874); // PyAPI: `subgrid.node_values[2][20]` + assert(node_values_index[1] == 0.03052158400782889); // PyAPI: `subgrid.node_values[1][20]` + assert(node_values_index[2] == 0.03052158400782889); // PyAPI: `subgrid.node_values[2][20]` // PyAPI: `grid.subgrid(0, 0, 0).to_array(subgrid.shape)[16][20][20]` - assert(subgrid_array[index] == -4.9361569250960126e-07); + assert(subgrid_array[index] == -4.936156925096015e-07); } break; } diff --git a/examples/fortran/lhapdf_example.output b/examples/fortran/lhapdf_example.output index 8f8ef4a8c..8a35b276a 100644 --- a/examples/fortran/lhapdf_example.output +++ b/examples/fortran/lhapdf_example.output @@ -1,6 +1,6 @@ Computing predictions with the same PDF: NNPDF31_nlo_as_0118_luxqed - 7.1330573367786162E-005 2.1399172010335844E-004 + 7.1330573367785985E-005 2.1399172010335785E-004 Computing predictions with different PDFs and alphasQ2(NNPDF31_nlo_as_0118_luxqed): - 7.3091433321743459E-005 2.1927429996523032E-004 + 7.3091433321743418E-005 2.1927429996523019E-004 Computing predictions with different PDFs and alphasQ2(MSHT20qed_nnlo): - 7.3462246623863092E-005 2.2038673987158919E-004 + 7.3462246623863024E-005 2.2038673987158908E-004 diff --git a/pineappl/Cargo.toml b/pineappl/Cargo.toml index a1f86f204..6d2622643 100644 --- a/pineappl/Cargo.toml +++ b/pineappl/Cargo.toml @@ -32,7 +32,6 @@ rayon = "1.5.1" rustc-hash = "1.1.0" serde = { features = ["derive"], version = "1.0.130" } thiserror = "1.0.30" -lambert_w = "1.2.31" [dev-dependencies] lhapdf = { package = "managed-lhapdf", version = "0.3.4" } diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index f67cbdad1..8cf176698 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -16,9 +16,21 @@ mod applgrid { } pub fn fx2(y: f64) -> f64 { - let z = 5.0 * (5.0-y).exp(); - let w = lambert_w::lambert_w0(z); - return w / 5.0; + let mut yp = y; + let mut deltap = f64::INFINITY; + + for _ in 0..10 { + let x = (-yp).exp(); + let delta = (1.0 - x).mul_add(-5.0, y - yp); + if (delta.abs() < 1e-15) && (delta >= deltap) { + return x; + } + let deriv = x.mul_add(-5.0, -1.0); + yp -= delta / deriv; + deltap = delta; + } + + unreachable!(); } pub fn fy2(x: f64) -> f64 { @@ -477,11 +489,11 @@ mod tests { assert_eq!(node_values[2].len(), interps[2].nodes()); for (&node, ref_node) in node_values[1].iter().zip(x_reference) { - assert_approx_eq!(f64, node, ref_node, epsilon = 1e-12); + assert_approx_eq!(f64, node, ref_node, ulps = 4); } for (&node, ref_node) in node_values[2].iter().zip(x_reference) { - assert_approx_eq!(f64, node, ref_node, epsilon = 1e-12); + assert_approx_eq!(f64, node, ref_node, ulps = 4); } let mut array = crate::packed_array::PackedArray::::new(vec![40, 50, 50]); diff --git a/pineappl/src/subgrid.rs b/pineappl/src/subgrid.rs index 04381c3b0..c09968de6 100644 --- a/pineappl/src/subgrid.rs +++ b/pineappl/src/subgrid.rs @@ -11,7 +11,7 @@ use std::{iter, mem}; /// TODO #[must_use] pub fn node_value_eq(lhs: f64, rhs: f64) -> bool { - approx_eq!(f64, lhs, rhs, epsilon = 1e-12) + approx_eq!(f64, lhs, rhs, ulps = 4096) } /// TODO diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index 47e46492f..47669bd7c 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, epsilon = 1e-10); + assert_approx_eq!(f64, *result, *reference, ulps = 4); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` From c0b83ddf5cd8d6d1430f0d8e370974c953f63100 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 20 Nov 2025 19:20:21 +0100 Subject: [PATCH 16/18] Fix bugs in stopping condition of Newton iteration --- pineappl/src/interpolation.rs | 2 +- pineappl/tests/drell_yan_lo.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pineappl/src/interpolation.rs b/pineappl/src/interpolation.rs index 8cf176698..436615e41 100644 --- a/pineappl/src/interpolation.rs +++ b/pineappl/src/interpolation.rs @@ -22,7 +22,7 @@ mod applgrid { for _ in 0..10 { let x = (-yp).exp(); let delta = (1.0 - x).mul_add(-5.0, y - yp); - if (delta.abs() < 1e-15) && (delta >= deltap) { + if (delta == 0.0) || ((delta.abs() < 2e-15) && (delta.abs() >= deltap.abs())) { return x; } let deriv = x.mul_add(-5.0, -1.0); diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index 47669bd7c..2bcb5f25f 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -363,7 +363,7 @@ fn perform_grid_tests( let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); for (result, reference) in bins.iter().zip(reference.iter()) { - assert_approx_eq!(f64, *result, *reference, ulps = 4); + assert_approx_eq!(f64, *result, *reference, ulps = 8); } // TEST 5b: `convolve` with `ConvolutionCache::with_two` @@ -397,8 +397,8 @@ fn perform_grid_tests( for (&node_value1, &node_value2, &ref_value) in izip!(&node_values[1], &node_values[2], x_grid) { - assert_approx_eq!(f64, node_value1, ref_value, ulps = 4); - assert_approx_eq!(f64, node_value2, ref_value, ulps = 4); + assert_approx_eq!(f64, node_value1, ref_value, ulps = 8); + assert_approx_eq!(f64, node_value2, ref_value, ulps = 8); } let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]); From a2712191cf35b6c3ff28d43b6743865a4094b9a9 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 20 Nov 2025 19:36:28 +0100 Subject: [PATCH 17/18] Fix failing CAPI example --- examples/cpp/get-subgrids.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/cpp/get-subgrids.cpp b/examples/cpp/get-subgrids.cpp index 5cd1385de..29836877c 100644 --- a/examples/cpp/get-subgrids.cpp +++ b/examples/cpp/get-subgrids.cpp @@ -136,11 +136,11 @@ int main() { // Check the values of the node entries. assert(node_values_index[0] == 5442.30542919352900); // PyAPI: `subgrid.node_values[0][16]` - assert(node_values_index[1] == 0.03052158400782889); // PyAPI: `subgrid.node_values[1][20]` - assert(node_values_index[2] == 0.03052158400782889); // PyAPI: `subgrid.node_values[2][20]` + assert(node_values_index[1] == 0.03052158400782890); // PyAPI: `subgrid.node_values[1][20]` + assert(node_values_index[2] == 0.03052158400782890); // PyAPI: `subgrid.node_values[2][20]` // PyAPI: `grid.subgrid(0, 0, 0).to_array(subgrid.shape)[16][20][20]` - assert(subgrid_array[index] == -4.936156925096015e-07); + assert(subgrid_array[index] == -4.936156925096021e-07); } break; } From 0cd2bb110d92503f5fe84371d8c823f2941fe7f5 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 20 Nov 2025 19:46:54 +0100 Subject: [PATCH 18/18] Fix failing Fortran example --- examples/fortran/lhapdf_example.output | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/fortran/lhapdf_example.output b/examples/fortran/lhapdf_example.output index 8a35b276a..f86f8b32b 100644 --- a/examples/fortran/lhapdf_example.output +++ b/examples/fortran/lhapdf_example.output @@ -1,6 +1,6 @@ Computing predictions with the same PDF: NNPDF31_nlo_as_0118_luxqed - 7.1330573367785985E-005 2.1399172010335785E-004 + 7.1330573367785999E-005 2.1399172010335790E-004 Computing predictions with different PDFs and alphasQ2(NNPDF31_nlo_as_0118_luxqed): - 7.3091433321743418E-005 2.1927429996523019E-004 + 7.3091433321743418E-005 2.1927429996523024E-004 Computing predictions with different PDFs and alphasQ2(MSHT20qed_nnlo): 7.3462246623863024E-005 2.2038673987158908E-004