|
Boost Users : |
From: Eric Niebler (eric_at_[hidden])
Date: 2008-05-19 19:42:52
Ray Burkholder wrote:
>
> A general question about its capabilities. The library is excellent for
> getting updated statistics as one adds values to an accumulator.
>
> I have one wrinkle. I have long running time series, and wish to evaluate
> statistics on a window of the data, say the last 100 values. Can the
> Accumulator framework be used in a 'windowed' situation?
It can, but you would have to code up such a windowing accumulator
yourself. The docs show how to extend the accumulators framework. An
accumulator like a rolling average is non-trivial, though.
I once wrote a rolling average function object for use with the
Boost.Time_series library. It uses boost::circular_buffer to store the
last N elements. You would need to do a bit of work to adapt this for
use with the accumulators library, but the logic is there for the
taking. You can find it here:
http://lists.boost.org/Archives/boost/2007/07/124979.php
-- Eric Niebler Boost Consulting www.boost-consulting.com
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