Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Private Attributes

SgStatistics< VALUE, COUNT > Class Template Reference

Computes mean and variance of a statistical variable. More...

#include <SgStatistics.h>

List of all members.

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

Detailed Description

template<typename VALUE, typename COUNT>
class SgStatistics< VALUE, COUNT >

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.


Constructor & Destructor Documentation

template<typename VALUE , typename COUNT >
SgStatistics< VALUE, COUNT >::SgStatistics (  ) 

Definition at line 274 of file SgStatistics.h.

References SgStatistics< VALUE, COUNT >::Clear().

template<typename VALUE, typename COUNT>
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.


Member Function Documentation

template<typename VALUE, typename COUNT >
void SgStatistics< VALUE, COUNT >::Add ( VALUE  val  ) 
template<typename VALUE , typename COUNT >
void SgStatistics< VALUE, COUNT >::Clear (  ) 
template<typename VALUE , typename COUNT >
COUNT SgStatistics< VALUE, COUNT >::Count (  )  const
template<typename VALUE , typename COUNT >
VALUE SgStatistics< VALUE, COUNT >::Deviation (  )  const
template<typename VALUE , typename COUNT >
bool SgStatistics< VALUE, COUNT >::IsDefined (  )  const
template<typename VALUE , typename COUNT >
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.

template<typename VALUE , typename COUNT >
VALUE SgStatistics< VALUE, COUNT >::Mean (  )  const
template<typename VALUE , typename COUNT >
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.

template<typename VALUE , typename COUNT >
VALUE SgStatistics< VALUE, COUNT >::Variance (  )  const

Definition at line 345 of file SgStatistics.h.

References SgStatistics< VALUE, COUNT >::m_variance.

template<typename VALUE , typename COUNT >
void SgStatistics< VALUE, COUNT >::Write ( std::ostream &  out  )  const

Member Data Documentation

template<typename VALUE, typename COUNT>
SgStatisticsBase<VALUE,COUNT> SgStatistics< VALUE, COUNT >::m_statisticsBase [private]
template<typename VALUE, typename COUNT>
VALUE SgStatistics< VALUE, COUNT >::m_variance [private]

The documentation for this class was generated from the following file:


Sun Mar 13 2011 Doxygen 1.7.1