Home

KahanSummation.jl

This package uses the Kahan-Babuska-Neumaier (KBN) compensated summation algorithm for computing sums and cumulative sums. The sum and cumsum functions in Julia's Base library use pairwise summation, which provides high accuracy and good performance. The KBN algorithm significantly reduces numerical error at the cost of performance and memory efficiency.

KahanSummation.sum_kbn โ€” Function.
sum_kbn(A)

Return the sum of all elements of A, using the Kahan-Babuska-Neumaier compensated summation algorithm for additional accuracy.

source
KahanSummation.cumsum_kbn โ€” Function.
cumsum_kbn(A, dim::Integer)

Cumulative sum along a dimension, using the Kahan-Babuska-Neumaier compensated summation algorithm for additional accuracy.

source