Boost logo

Boost Users :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-01-10 13:16:33

John Maddock wrote:
>>I have some simple stuff in the sandbox under the "stat" directory.
>>You can view its usage here:
> Otto: first off we really need something like this, in Boost and in the std
> as well IMO. It really galls me that my desktop calculator has more math
> functions than <cmath> has, and wait for it: my calculator is 25 years old
> !!!!!!!!
> However, I'm not sure that either of us has the right interface yet: I'm
> particularly concerned that you're making these algorithms, it means that if
> you want to access more than one statistic you have to make multiple passes
> over the data. The advantage of the "make it an object" approach is that
> pretty much all stats you could want are accessible after a single pass over
> the data. More than that you can:
> * Pause at any time and read off the stats, and then continue adding more
> data if you want.

I have been working on a statistical library based on an incremental
calculation model. The syntax is like this:

// define an accumulator set for calculating mean and max
// of a sequence of doubles
accumulator_set<double, stats<tag::mean, tag::max> > acc;

// push some data into the accumulator

// fetch some intermediate results
std::cout << mean(acc) << std::endl;

/* push more data, etc. */

Some statistics may depend on the results of other statistics, in which
case they are calculated automatically and in the correct order.

The set of statistical accumulators is extensible, of course.

I hope to have a version available online Real Soon Now.

Eric Niebler
Boost Consulting

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at