Private Attributes

Detailed Description

Maintain a blocked running average.

This class is like UtilRunningAverage but instead of only allowing single samples to be accumulated, it allows blocks of samples that already have statistics calculated on them to be accumulated such that correct statistics can be formed on the union of all blocks.

In this class, the "population" statistics will be identical to that of UtilRunningAverage.

The "sample" statistics will in general differ because a different rule governs the sample size. Namely this class will keep all blocked samples such that removing the oldest does not bring the sample size below the target.

All blocked samples are retained so that the statistics can be calculated in O(1) time.

Note:

Although the labels "sample" and "population" are used, both are treated as samples for the purpose of statistic calculations.

Member Function Documentation

int UtilBlockedRunningAverage::Add

(

double

mean,

double

sigma,

int

nsamples

)

Add a new block of samples. Return the size of the sample set after this addition. Note, this size be be smaller than before the addition if a larger block is pushed out of the set. However, once the sample size is larger than the target, it will never be allowed to go smaller than the target.

Set the target sample size. The actual sample size may be temporarily smaller than this. Once full, the actual sample size will never go below this but in general will fluctuate higher as more blocks of samples are added or removed.