#include <OpenMS/MATH/STATISTICS/BasicStatistics.h>
The intended usage is as follows:
Public Types | |
typedef RealT | RealType |
The real type specified as template argument. | |
typedef std::vector< RealType > | probability_container |
typedef std::vector< RealType > | coordinate_container |
Public Member Functions | |
BasicStatistics () | |
Default constructor. | |
BasicStatistics (BasicStatistics const &arg) | |
Copy constructor. | |
BasicStatistics & | operator= (BasicStatistics const &arg) |
Assignment. | |
void | clear () |
Set sum, mean, and variance to zero. | |
template<typename ProbabilityIterator> | |
void | update (ProbabilityIterator probability_begin, ProbabilityIterator const probability_end) |
This does the actual calculation. | |
template<typename ProbabilityIterator, typename CoordinateIterator> | |
void | update (ProbabilityIterator const probability_begin, ProbabilityIterator const probability_end, CoordinateIterator const coordinate_begin) |
This does the actual calculation. | |
RealType | mean () const |
Returns the mean. | |
void | setMean (RealType const &mean) |
RealType | variance () const |
Returns the variance. | |
void | setVariance (RealType const &variance) |
RealType | sum () const |
Returns the sum. | |
void | setSum (RealType const &sum) |
RealType | normalDensity_sqrt2pi (RealType coordinate) const throw () |
Returns the density of the normal approximation at point, multiplied by sqrt( 2 * pi ). This saves a division operation compared to normalDensity(). | |
RealType | normalDensity (RealType const coordinate) const throw () |
See normalDensity_sqrt2pi(). Returns the density of the normal distribution at point. | |
void | normalApproximation (probability_container &probability) |
The argument probability is filled with values according to the normal approximation. Its size() is not changed. The approximation takes place at coordinate positions 0, 1, ..., size()-1. | |
void | normalApproximation (probability_container &probability, typename probability_container::size_type const size) |
void | normalApproximation (probability_container &probability, coordinate_container const &coordinate) |
The argument probability is filled with values according to the normal approximation. The second argument coordinate contains the positions where the approximation takes place. probability.size() is set to coordinate.size(). | |
Static Public Member Functions | |
static RealType | sqrt2pi () |
Returns sqrt( 2 * pi ), which is useful to normalize the result of normalDensity_sqrt2pi(). | |
Protected Attributes | |
Protected Members | |
RealType | mean_ |
RealType | variance_ |
RealType | sum_ |
Private Member Functions | |
Private Methods | |
void | normalApproximationHelper_ (probability_container &probability, typename probability_container::size_type const size) |
void | normalApproximationHelper_ (probability_container &probability, coordinate_container const &coordinate) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, BasicStatistics &arg) |
A convenient overload for debugging purposes. |
typedef RealT RealType |
typedef std::vector< RealType > probability_container |
typedef std::vector< RealType > coordinate_container |
BasicStatistics | ( | ) | [inline] |
Default constructor.
BasicStatistics | ( | BasicStatistics< RealT > const & | arg | ) | [inline] |
Copy constructor.
BasicStatistics& operator= | ( | BasicStatistics< RealT > const & | arg | ) | [inline] |
Assignment.
void clear | ( | ) | [inline] |
Set sum, mean, and variance to zero.
void update | ( | ProbabilityIterator | probability_begin, | |
ProbabilityIterator const | probability_end | |||
) | [inline] |
This does the actual calculation.
You can call this as often as you like, using different input vectors.
void update | ( | ProbabilityIterator const | probability_begin, | |
ProbabilityIterator const | probability_end, | |||
CoordinateIterator const | coordinate_begin | |||
) | [inline] |
This does the actual calculation.
You can call this as often as you like, using different input vectors.
Reimplemented in AsymmetricStatistics.
RealType mean | ( | ) | const [inline] |
Returns the mean.
void setMean | ( | RealType const & | mean | ) | [inline] |
RealType variance | ( | ) | const [inline] |
Returns the variance.
void setVariance | ( | RealType const & | variance | ) | [inline] |
RealType sum | ( | ) | const [inline] |
Returns the sum.
void setSum | ( | RealType const & | sum | ) | [inline] |
Returns the density of the normal approximation at point, multiplied by sqrt( 2 * pi ). This saves a division operation compared to normalDensity().
static RealType sqrt2pi | ( | ) | [inline, static] |
Returns sqrt( 2 * pi ), which is useful to normalize the result of normalDensity_sqrt2pi().
See normalDensity_sqrt2pi(). Returns the density of the normal distribution at point.
void normalApproximation | ( | probability_container & | probability | ) | [inline] |
The argument probability
is filled with values according to the normal approximation. Its size()
is not changed. The approximation takes place at coordinate positions 0, 1, ..., size()-1.
void normalApproximation | ( | probability_container & | probability, | |
typename probability_container::size_type const | size | |||
) | [inline] |
The argument probability
is filled with values according to the normal approximation. Its size() is set to size
. The approximation takes place at coordinate positions 0, 1, ..., size-1.
void normalApproximation | ( | probability_container & | probability, | |
coordinate_container const & | coordinate | |||
) | [inline] |
The argument probability is filled with values according to the normal approximation. The second argument coordinate contains the positions where the approximation takes place. probability.size() is set to coordinate.size().
void normalApproximationHelper_ | ( | probability_container & | probability, | |
typename probability_container::size_type const | size | |||
) | [inline, private] |
void normalApproximationHelper_ | ( | probability_container & | probability, | |
coordinate_container const & | coordinate | |||
) | [inline, private] |
std::ostream& operator<< | ( | std::ostream & | os, | |
BasicStatistics< RealT > & | arg | |||
) | [friend] |
A convenient overload for debugging purposes.
Generated Tue Apr 1 15:36:50 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |