Opened 12 years ago
Closed 11 years ago
#4471 closed Feature Requests (fixed)
Kahan sum
Reported by: | anonymous | Owned by: | Eric Niebler |
---|---|---|---|
Milestone: | Boost 1.44.0 | Component: | accumulator |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Request to have Kahan algorithm added to accumulators.
Attachments (1)
Change History (3)
by , 12 years ago
comment:1 by , 12 years ago
From Gaetano:
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));
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
patch for kahan sum