Skip to content

rusticol-core: native high-precision evaluation for contracted-color replay; constants at working precision - #26

Open
lsimon125 wants to merge 2 commits into
MadGraphTeam:loopfrom
lsimon125:replay-multiprecision
Open

lsimon125 wants to merge 2 commits into
MadGraphTeam:loopfrom
lsimon125:replay-multiprecision

Conversation

@lsimon125

Copy link
Copy Markdown

Summary

Two fixes to NativeRuntime::evaluate_with_precision (feature symbolica-runtime) for compiled artifacts.

  1. Contracted-color topology replay in double-double and arbitrary precision. Full-colour (and NLC) pure-gluon
    processes always use the contracted-color topology replay, and run_double/run_float rejected it ("compiled/eager
    contracted-color topology replay currently exposes f64"). run_generic_with_color_topology_replay now evaluates the
    materialized sectors at every replay relabelling in the generic precision, routes their summed groups to the physical
    groups (gather_color_topology_replay_generic, mirroring gather_color_topology_replay_samples) and contracts them
    (reduce_color_topology_replay_generic). The group contraction of evaluate_raw_sums_generic is factored into
    contract_groups_generic and shared; run_generic_materialized and the replay share the extracted stage evaluation
    evaluate_generic_stages.

  2. Artifact constants at the working precision. Above 32 digits the results had binary64 accuracy, padded with
    digits, for every compiled artifact (with or without replay). The generic path converted binary64 constants
    (normalization, colour weights, model parameters, masses, source-state factors, replay weights, process-group
    factor) with T::from(f64), i.e. a 53-bit numerica Float, and a Float product is rounded to the smaller
    precision of its factors. RusticolHighPrecisionNumber::from_f64_constant now converts them at the working
    precision (Float::with_val(binary_precision, value); unchanged for DoubleFloat); the generic source fill uses
    masses converted the same way via CarrierMasses. Unit crossing signs and phases are unchanged (numerica
    multiplies by ±1 without rounding).

The constants themselves remain the artifact's binary64 values (as before); this change only stops them from capping
the precision of everything they multiply.

Tests

rust/crates/rusticol-core/tests/compiled_color_topology_replay_precision.rs (runs when
RUSTICOL_COMPILED_COLOR_REPLAY_ARTIFACT points to
pyamplicol generate 'g g > g g' DIR --color-accuracy full --execution-mode compiled): exact massless integer points;
ratios of totals between points cancel the couplings and must equal the exact tree-level ratios of
9/2 (3 − tu/s² − su/t² − st/u²) to ≤ 1e-27 at 32 digits and ≤ 1e-58 at 64 digits; totals agree with binary64 to
≤ 1e-12.

Ratios to the exact analytic values:

before after
g g > g g, 32 digits error: replay exposes f64 4e-33, 7e-33
g g > g g, 64 digits error: replay exposes f64 within 1e-58 (test passes)
u d > u d (no replay), 40 / 64 / 100 digits 1.5e-16 each 5.1e-40 / 2.1e-64 / 5.7e-101
u d > u d, u u~ > g g, 32 digits 4.8e-32, 8.7e-32 unchanged

Run on loop at bae3b9e plus these two commits (candidate build, artifact from that generator): the new test
passes at 32 and 64 digits; compiled_binary64_with_symbolica passes; the 152 rusticol-core unit tests matching
generic/precision/double/float/exact/replay pass (with PYAMPLICOL_TEST_PYTHON set for the Python-producer
round trip). The ratio values in the table were measured with the same two commits on 79df367 and the
u d > u d / u u~ > g g artifacts of that generator.

cargo check -p rusticol-core with default features, symbolica-runtime and loop-v2: no new warnings.

🤖 Generated with Claude Code

lsimon125 and others added 2 commits October 25, 2026 16:45
…e-double and arbitrary precision

Full-colour (and NLC) pure-gluon processes always use the contracted-color
topology replay, and `run_double`/`run_float` rejected it ("compiled/eager
contracted-color topology replay currently exposes f64"), so
`evaluate_with_precision` failed for them.

`run_generic_with_color_topology_replay` evaluates the materialized sectors at
every replay relabelling in the generic precision, routes their summed groups
to the physical groups (`gather_color_topology_replay_generic`, the
counterpart of `gather_color_topology_replay_samples`) and contracts them
(`reduce_color_topology_replay_generic`). The group contraction of
`evaluate_raw_sums_generic` moves into `contract_groups_generic`, shared by
both; `run_generic_materialized` and the replay share the extracted stage
evaluation `evaluate_generic_stages`.

`tests/compiled_color_topology_replay_precision.rs` (artifact from
`RUSTICOL_COMPILED_COLOR_REPLAY_ARTIFACT`) compares ratios of g g > g g totals
between exact massless integer points with the exact tree-level ratios at 32
digits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Arbitrary-precision evaluation (`evaluate_with_precision` above 32 digits)
returned binary64 accuracy padded with digits. The generic path converts the
artifact's binary64 constants (normalization, colour weights, model
parameters, masses, source-state factors, replay weights, process-group
factor) with `T::from(f64)`, which gives a 53-bit numerica `Float`; a `Float`
product is rounded to the smaller precision of its factors, so every result
was rounded to binary64.

`RusticolHighPrecisionNumber::from_f64_constant` converts such a constant at
the working precision (`Float::with_val(binary_precision, value)`; unchanged
for `DoubleFloat`), and the generic source fill uses masses converted the same
way (`CarrierMasses`). Unit crossing signs and phases are left as they are:
numerica multiplies by +-1 without rounding.

The replay test now also checks 64 digits against the exact tree-level ratios.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant