Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-01-10 13:21:21


> Right. It's a trade-off. OTOH, if you only call one algorithm, you
> don't want to pay for accumulation that is not used. So maybe we need
> algorithms that takes iterators and algorithms that take some kind of
> accumulator object.

Or you could parameterise the accumulator so it only accumuates what you
need.

>> Unfortunately: this method is prone to numerical overflow/underflow
>> :-(
>
> How can this be different than just accumulating it all from scratch?
> (Or is it the accumulator method in general that is error-prone?)

Yes, the method we're both using I think is the "schoolboy" accumulate the
sum of the squares method. It's perfectly good enough for many purposes but
Knuth has an alternative that accumulates the sum of the differences from
the "working" mean only, see the last method at
http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance I haven't
investigated this at all except to note that it exists, and actually looking
again it might support most of the operations that the current methodology
does (not sure about rms mean and the S N-1 "unbiased" variance though).

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net