Skip to main content

compensated_sum_array

Function compensated_sum_array 

Source
pub fn compensated_sum_array<T: Float>(values: &ArrayView1<'_, T>) -> T
Expand description

Compute a compensated (Neumaier) sum of an ndarray view.

Uses Neumaier’s improvement over Kahan summation: when the addend is larger in magnitude than the running sum the compensation tracks the smaller value, giving correct results even for inputs like [1e20, 1.0, -1e20].