|
Boost : |
Subject: Re: [boost] accurate sum accumulator (kahan)
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2010-07-27 13:14:47
On 07/27/2010 03:04 PM, Eric Niebler wrote:
> just tell what what text you'd like to see inserted
> where in the docs and I'll do it.
At this page:
I would add a link sum_kahan pointing to this:
===================================================
sum_kahan
Implements the summation kahan's algorithm, reducing the accumulation
error in case of floating point types.
Result Type
sample-type
Depends On
none
Variants
none
Initialization Parameters
none
Accumulator Parameters
none
Extractor Parameters
none
Accumulator Complexity
O(1), however compared to naive sum this accumulator
performs 4 sum operations for each element accumulated
Extractor Complexity
O(1)
Header
#include <boost/accumulators/statistics/sum_kahan.hpp>
Example
accumulator_set<float, stats<tag::sum_kahan> > acc;
BOOST_CHECK_EQUAL(0.0f, sum_kahan(acc));
for (size_t i = 0; i < 1e6; ++i) {
acc(1e-6f);
}
BOOST_CHECK_EQUAL(1.0f, sum_kahan(acc));
=========================================================
I'm not sure if this was what you meant by documentation.
Regards
Gaetano Mendola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk