Re: [Boost-bugs] [Boost C++ Libraries] #4471: Kahan sum

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4471: Kahan sum
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-04-12 17:09:16


#4471: Kahan sum
-------------------------------+--------------------------------------------
  Reporter: anonymous | Owner: eric_niebler
      Type: Feature Requests | Status: new
 Milestone: Boost 1.44.0 | Component: accumulator
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------------------------

Comment (by eric_niebler):

 From Gaetano:

 At this page:

 http://www.boost.org/doc/libs/1_43_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library

 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));
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4471#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC