Class describing a statistical sample.
#include <Sample.h>
Public Member Functions | |
void | merge (const Sample &other) |
template<typename T > | |
iterator | castToRealAndInsert (const T &val) |
template<typename T > | |
iterator | castToRealAndInsert (const_iterator position, const T &val) |
template<class InputIterator > | |
void | castToRealAndInsert (InputIterator first, InputIterator last) |
void | mpiAllGather () |
Combines the samples from all processes and stores the result on each process. More... | |
void | mpiGather (int rank) |
Combines the samples from all processes and stores the result on process 'rank'. More... | |
void | mpiGatherRoot () |
Combines the samples from all processes and stores the result on the root process. More... | |
real_t | sum () const |
real_t | min () const |
real_t | max () const |
real_t | range () const |
real_t | mean () const |
real_t | median () const |
Calculates the median of the sample. More... | |
real_t | variance () const |
real_t | stdDeviation () const |
real_t | relativeStdDeviation () const |
Calculates the relative standard deviation of the sample. More... | |
real_t | mad () const |
Calculates the median absolute deviation (MAD) of the sample. More... | |
real_t | giniCoefficient () const |
Calculates the Gini coefficient of the sample. More... | |
real_t | cummulativeDistributionFunction (const real_t x) const |
real_t | quantile (const real_t p) const |
Calculates a quantile of the sample. More... | |
std::string | format (const std::string &formatString=DEFAULT_FORMAT_STRING) const |
Generates a string with attributes of the sample. More... | |
Private Member Functions | |
real_t | variance (real_t mean) const |
Calculates the variance of the sample. More... | |
Static Private Attributes | |
static const std::string | DEFAULT_FORMAT_STRING |
Sample::iterator walberla::math::Sample::castToRealAndInsert | ( | const T & | val | ) |
Sample::iterator walberla::math::Sample::castToRealAndInsert | ( | const_iterator | position, |
const T & | val | ||
) |
void walberla::math::Sample::castToRealAndInsert | ( | InputIterator | first, |
InputIterator | last | ||
) |
std::string walberla::math::Sample::format | ( | const std::string & | formatString = DEFAULT_FORMAT_STRING | ) | const |
Generates a string with attributes of the sample.
The following patters are replaced in the format string:
min by min() max by max() sum by sum() mean by mean() med by median() var by variance() stddev by stdDeviation() relstddev by relativeStdDeviation() mad by mad() size by size()
real_t walberla::math::Sample::giniCoefficient | ( | ) | const |
Calculates the Gini coefficient of the sample.
http://en.wikipedia.org/w/index.php?title=Gini_coefficient&oldid=608263369
real_t walberla::math::Sample::mad | ( | ) | const |
Calculates the median absolute deviation (MAD) of the sample.
MAD is a robust alternative to the standard deviation.
See http://en.wikipedia.org/w/index.php?title=Median_absolute_deviation&oldid=608254065
|
inline |
|
inline |
real_t walberla::math::Sample::median | ( | ) | const |
Calculates the median of the sample.
In case of size() being an even number, the average of the two central elements is returned.
|
inline |
|
inline |
void walberla::math::Sample::mpiAllGather | ( | ) |
Combines the samples from all processes and stores the result on each process.
Note that this is a collective MPI operation. It has to be called by all processes!
void walberla::math::Sample::mpiGather | ( | int | rank | ) |
Combines the samples from all processes and stores the result on process 'rank'.
Note that this is a collective MPI operation. It has to be called by all processes!
rank | The rank of the process the combined sample is stored on. |
void walberla::math::Sample::mpiGatherRoot | ( | ) |
Combines the samples from all processes and stores the result on the root process.
Note that this is a collective MPI operation. It has to be called by all processes!
Calculates a quantile of the sample.
To understand how the quantiles are calculated please see http://tinyurl.com/d8vm37f. Quantiles are rounded outwards.
|
inline |
real_t walberla::math::Sample::relativeStdDeviation | ( | ) | const |
Calculates the relative standard deviation of the sample.
Equals stdDeviation / mean()
|
inline |
|
inline |
|
inline |
Calculates the variance of the sample.
The variance calculated here is the uncorrected variance. See: http://en.wikipedia.org/w/index.php?title=Bessel%27s_correction&oldid=526066331
theMean | the mean() |
|
staticprivate |