I am curious, what average is obtained from this code snippet? The accumulator is intended to be empty.
boost::accumulators::accumulator_set<
int,
boost::accumulators::features<boost::accumulators::tag::mean>
> Accumulator;
int Mean = boost::accumulators::mean(Accumulator);
The average is non-zero when I test it. Is there some way I can tell that the average was taken for an empty data set? Why is the resulting value for “Mean” non-zero?
I was looking around in the documentation for the accumulator library, but was unable to find an answer to this question.
Any value would be a valid mean for an empty set of values. That is
x * 0 = 0holds for anyx.You could add a
countfeature to youraccumulator_setand query it to see if its 0.