Go to the documentation of this file.
6 #ifndef OPENMPCD_ONTHEFLYSTATISTICS_HPP
7 #define OPENMPCD_ONTHEFLYSTATISTICS_HPP
12 #include <boost/static_assert.hpp>
13 #include <boost/type_traits/is_integral.hpp>
41 : sampleSize(0), mean(0), varianceHelper(0)
73 const T getSampleVariance()
const
93 return sqrt(getSampleVariance());
121 BOOST_STATIC_ASSERT(!boost::is_integral<T>::value);
125 const T delta(datum - mean);
127 mean += delta / sampleSize;
128 varianceHelper += delta * (datum - mean);
164 std::size_t sampleSize;
172 #endif //OPENMPCD_ONTHEFLYSTATISTICS_HPP
OnTheFlyStatistics()
The constructor.
Exception for a forbidden function call.
void addDatum(const T &datum)
Adds a datum to the sample.
std::size_t getSampleSize() const
Returns the number of data points added so far.
const T getSampleStandardDeviation() const
Returns the unbiased sample variance of all the values added so far.
const T getSampleMean() const
Returns the mean of all the values added so far.
#define OPENMPCD_DEBUG_ASSERT_EXCEPTIONTYPE(assertion, ExceptionType)
const std::string serializeToString() const
Returns a string that contains the state of this instance.
const T getStandardErrorOfTheMean() const
Returns the standard error of the mean, i.e.
void unserializeFromString(const std::string &state)
Discards the current state, and loads the state specified in the given string instead.
OPENMPCD_CUDA_HOST_AND_DEVICE T sqrt(const T x)
Returns the sqaure root of the argument.
Computes sample means and variances "on-the-fly" or "online", i.e.