Boost logo

Boost Users :

Subject: Re: [Boost-users] [accumulators] Any was to reset an accumulator_set object?
From: er (erwann.rogard_at_[hidden])
Date: 2009-03-01 18:12:46

dhruva wrote:
> Hello,
> I am using boost::accumulator_set to compute mean. After every 100 samples, I need to start afresh. Since I am using accumulator_set as a member variable in a class

(I get samples one at a time and need to preserve accumulator_set object
across function calls), I need some mechanism to reset it to its initial

I am not doing anything fancy like using droppable functionality. As a
real crude work around, I am keeping 2 objects. The first is not used
for any computing and hence

its state is same throughout. The computing is done using the second
object. After 100 samples, I just copy the first onto the second hoping
the state of second object will

be same as first which is the initial state.
> Is there a better way to achieve the above requirement?
> -dhruva
> Download prohibited? No problem. CHAT from any browser, without download. Go to

As a user of this library I'd think that if n+m is the current iteration
and you want to go back to state n, the easiest way -as you say- is to
create a copy of the set at n. But if n = 0, perhaps obj.set =
set_type(initial parameters)?

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