pub trait NeumaierAddable: Sized {
// Required method
fn neumaier_compensated_sum(
value: Self,
sum: &mut Self,
compensation: &mut Self,
);
}Expand description
A trait for types that can participate in Neumaier compensated summation.
This trait provides the core operation for the Neumaier summation algorithm, which is a numerically stable method for summing floating-point numbers with reduced rounding errors compared to naive summation.
§Algorithm
The Neumaier algorithm is an improvement over Kahan summation that handles the case when the new value is larger than the running sum. It maintains a compensation term to capture the low-order bits that are lost during addition.
Required Methods§
Sourcefn neumaier_compensated_sum(
value: Self,
sum: &mut Self,
compensation: &mut Self,
)
fn neumaier_compensated_sum( value: Self, sum: &mut Self, compensation: &mut Self, )
Performs one step of the Neumaier compensated summation algorithm.
This method adds value to the running sum while tracking lost precision
in the compensation term. The final result should be computed as
sum + compensation after all values have been added.
§Arguments
value- The value to add to the sum.sum- A mutable reference to the running sum.compensation- A mutable reference to the compensation term that tracks lost precision.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.