8 #ifndef ecl_statistics_CUMULATIVE_STATISTICS_HPP_ 9 #define ecl_statistics_CUMULATIVE_STATISTICS_HPP_ 34 template <
typename T,
typename Enable =
void>
45 void clear() { number_of_data = 0.0; }
58 if(number_of_data == 1.0)
60 old_mean = new_mean = x;
65 new_mean = old_mean +
static_cast<T
>(x - old_mean) / number_of_data;
66 new_variance = old_variance +
static_cast<T
>(x - old_mean) * static_cast<T>(x - new_mean);
69 old_variance = new_variance;
77 T
size()
const {
return number_of_data; }
83 T
mean()
const {
return (number_of_data > 0) ? new_mean : 0.0; }
89 T
variance()
const {
return ((number_of_data > 1) ? new_variance / (number_of_data - 1) : 0.0); }
T mean() const
Current cumulative calculation of mean.
void push_back(const T &x)
Dummy parent class for Homogenous points.
T variance() const
Current cumulative calculation of variance.