JuliaMath / KahanSummation.jl

Sum and cumulative sum using the Kahan-Babuska-Neumaier algorithm
MIT License
21 stars 11 forks source link

additional functionality #8

Open simonbyrne opened 6 years ago

simonbyrne commented 6 years ago

Part of my reason for #7 was to make it easier to extend. Some other functions we should provide:

goerch commented 2 years ago

I'm interested in #7, because it allows simple parallelization with something like

psum_kbn(f, X) = singleprec(Folds.mapreduce(f, InitialValues.asmonoid(plus_kbn), X))
psum_kbn(X) = psum_kbn(identity, X)

Is there anything wrong with the PR besides the fact that singleprec(x::TwicePrecisionN{T}) where {T} = x.hi - x.nlo is better suited for AD?