Computes mean and variance of a statistical variable. More...
#include <SgStatistics.h>
Public Member Functions | |
SgStatistics () | |
SgStatistics (VALUE val, COUNT count) | |
Create statistics initialized with values. | |
void | Add (VALUE val) |
void | Clear () |
bool | IsDefined () const |
VALUE | Mean () const |
COUNT | Count () const |
VALUE | Deviation () const |
VALUE | Variance () const |
void | Write (std::ostream &out) const |
Write in human readable format. | |
void | SaveAsText (std::ostream &out) const |
Save in a compact platform-independent text format. | |
void | LoadFromText (std::istream &in) |
Load from text format. | |
Private Attributes | |
SgStatisticsBase< VALUE, COUNT > | m_statisticsBase |
VALUE | m_variance |
Computes mean and variance of a statistical variable.
The template parameters are the floating point type and the counter type, depending on the precision-memory tradeoff.
Definition at line 232 of file SgStatistics.h.
SgStatistics< VALUE, COUNT >::SgStatistics | ( | ) |
Definition at line 274 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::Clear().
SgStatistics< VALUE, COUNT >::SgStatistics | ( | VALUE | val, | |
COUNT | count | |||
) |
Create statistics initialized with values.
Equivalent to creating a statistics and calling count
times Add(val)
Definition at line 280 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_variance.
void SgStatistics< VALUE, COUNT >::Add | ( | VALUE | val | ) |
void SgStatistics< VALUE, COUNT >::Clear | ( | ) |
Definition at line 307 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_statisticsBase, and SgStatistics< VALUE, COUNT >::m_variance.
Referenced by SgStatistics< VALUE, COUNT >::SgStatistics().
COUNT SgStatistics< VALUE, COUNT >::Count | ( | ) | const |
Definition at line 314 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_statisticsBase.
Referenced by SgStatistics< VALUE, COUNT >::Add().
VALUE SgStatistics< VALUE, COUNT >::Deviation | ( | ) | const |
Definition at line 320 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_variance.
Referenced by SgStatistics< VALUE, COUNT >::Write().
bool SgStatistics< VALUE, COUNT >::IsDefined | ( | ) | const |
Definition at line 326 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_statisticsBase.
Referenced by SgStatistics< VALUE, COUNT >::Add(), and SgStatistics< VALUE, COUNT >::Write().
void SgStatistics< VALUE, COUNT >::LoadFromText | ( | std::istream & | in | ) |
Load from text format.
See SaveAsText()
Definition at line 332 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_statisticsBase, and SgStatistics< VALUE, COUNT >::m_variance.
VALUE SgStatistics< VALUE, COUNT >::Mean | ( | ) | const |
Definition at line 339 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_statisticsBase.
Referenced by SgStatistics< VALUE, COUNT >::Add(), and SgStatistics< VALUE, COUNT >::Write().
void SgStatistics< VALUE, COUNT >::SaveAsText | ( | std::ostream & | out | ) | const |
Save in a compact platform-independent text format.
The data is written in a single line, without trailing newline.
Definition at line 360 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_statisticsBase, and SgStatistics< VALUE, COUNT >::m_variance.
VALUE SgStatistics< VALUE, COUNT >::Variance | ( | ) | const |
Definition at line 345 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::m_variance.
void SgStatistics< VALUE, COUNT >::Write | ( | std::ostream & | out | ) | const |
Write in human readable format.
Definition at line 351 of file SgStatistics.h.
References SgStatistics< VALUE, COUNT >::Deviation(), SgStatistics< VALUE, COUNT >::IsDefined(), and SgStatistics< VALUE, COUNT >::Mean().
SgStatisticsBase<VALUE,COUNT> SgStatistics< VALUE, COUNT >::m_statisticsBase [private] |
Definition at line 268 of file SgStatistics.h.
Referenced by SgStatistics< VALUE, COUNT >::Add(), SgStatistics< VALUE, COUNT >::Clear(), SgStatistics< VALUE, COUNT >::Count(), SgStatistics< VALUE, COUNT >::IsDefined(), SgStatistics< VALUE, COUNT >::LoadFromText(), SgStatistics< VALUE, COUNT >::Mean(), and SgStatistics< VALUE, COUNT >::SaveAsText().
VALUE SgStatistics< VALUE, COUNT >::m_variance [private] |
Definition at line 270 of file SgStatistics.h.
Referenced by SgStatistics< VALUE, COUNT >::Add(), SgStatistics< VALUE, COUNT >::Clear(), SgStatistics< VALUE, COUNT >::Deviation(), SgStatistics< VALUE, COUNT >::LoadFromText(), SgStatistics< VALUE, COUNT >::SaveAsText(), SgStatistics< VALUE, COUNT >::SgStatistics(), and SgStatistics< VALUE, COUNT >::Variance().