cancellation

Function cancellation 

Source
pub(super) fn cancellation<const N: usize>(
    parts: &[&Shells<N>],
    other: &Jet<N>,
    tail: f64,
    phase: &Jet<N>,
    sum: &Jet<N>,
    checked: &Checked<N>,
) -> Result<Rounding<N>>
Expand description

The predicted absolute rounding errors, in units of epsilon, of the value and derivatives of sum (phase times the Ewald parts and the self term other), or a failure where they cancel beyond use: where the error of a checked component plus the truncation tail of parts that did not converge to the complete sum (Shells::tail) exceeds MAX_LOSS of its scale, max(|S|, 1) for the value and |dS| + max(|S|, 1) s for a derivative (S = 0 for a sum that vanishes by symmetry). Each component predicts the bounds of the real-space Kambe integrals (SmallSplitKambe) plus TERM_ULPS times the moduli of the terms and of the self term, and an ulp of each compensated part (Shells).

Calibrated against the automatic split: the prediction exceeds the error of every sum more than 1e-11 off by a median factor of 45 at real and 87 at rotated splits (at least 4), and no sum that passes is more than 1.2e-4 off (not counting 1D spherical sums off the axis, see prefer_spectral_sw1d).