Expand description
Pluggable accumulation strategies for numerical algorithms.
This module defines the Accumulator trait and a set of concrete
implementations used internally by
crate::algorithms::vector_norms and available for use in custom
algorithms.
§Trait hierarchy
Accumulator
├── SumAccumulator (adds rescale_by; used for L1/L2 norms)
│ ├── NaiveSum
│ └── NeumaierSum
├── MaxAccumulator (running maximum of real values)
├── MinAccumulator (running minimum of real values)
└── MaxAbsValueAccumulator (running maximum of |x|; used for L∞ norm)§Choosing a summation strategy
| Strategy | Speed | Accuracy | Use when |
|---|---|---|---|
NaiveSum | fastest | O(N·ε) error | data is well-scaled |
NeumaierSum | ~2× slower | O(ε) error | components span many magnitudes |
§Parallel reduction
All accumulators support parallel chunked reductions via the default
Accumulator::new_parallel method, which uses rayon fold + reduce
with Accumulator::combine as the merge operation. Accumulator::new()
must be the identity element for combine — this holds for all types in
this module.
Structs§
- MaxAbs
Value Accumulator - Accumulator that computes the maximum absolute value over a sequence of
scalars:
maxᵢ |xᵢ|. - MaxAccumulator
- Accumulator that tracks the running maximum of real values.
- MinAccumulator
- Accumulator that tracks the running minimum of real values.
- Naive
Sum - Naive (plain
+=) accumulator. - Neumaier
Sum - Neumaier compensated accumulator for sums of floating-point (real or complex) numbers.
Traits§
- Accumulator
- Base trait for incremental accumulation over a sequence of values.
- Neumaier
Addable - A trait for types that can participate in Neumaier compensated summation.
- SumAccumulator
- A generic accumulator for summing a sequence of values with configurable precision/performance trade-offs.