13 #ifndef _H_SST_CORE_STATS_ACCUMULATOR
14 #define _H_SST_CORE_STATS_ACCUMULATOR
16 #include <sst/core/stats/basestats.h>
19 namespace Statistics {
29 <
template typename NumberBase>
65 void add(NumberBase value) {
68 sum_sq += (value * value);
78 void add(NumberBase* values, uint32_t length) {
80 for(uint32_t i = 0; i < length; ++i) {
82 sum_sq += (values[i] * values[i]);
85 count += (uint64_t) length;
94 return (count > 0) ? (sum / (NumberBase) count) : 0;
103 ((sum_sq * count) - (sum * sum)) :
112 return (NumberBase) std::sqrt( (
double)
getVariance() );
void add(NumberBase value)
Present a new value to the class to be included in the statistics.
Definition: accumulator.h:65
NumberBase getVariance()
Get the variance of the values presented so far.
Definition: accumulator.h:101
Accumulator(char *name)
Create a new Accumulator class with initial values set to a zero count, zero sum statistic of interes...
Definition: accumulator.h:37
Allows the online gathering of statistical information about a single quantity.
Definition: accumulator.h:30
NumberBase getArithmeticMean()
Get the arithmetic mean of the values presented so far.
Definition: accumulator.h:93
Definition: basestats.h:29
NumberBase getSum()
Provides the sum of the values presented so far.
Definition: accumulator.h:49
void add(NumberBase *values, uint32_t length)
Present an array of values to the class to be included in the statistics.
Definition: accumulator.h:78
NumberBase getStandardDeviation()
Get the standard deviation of the values presented so far.
Definition: accumulator.h:111
NumberBase getSumSquared()
Provides the sum of each value squared presented to the class so far.
Definition: accumulator.h:57
uint64_t getCount()
Get a count of the number of elements presented to the statistics collection so far.
Definition: accumulator.h:119