moab
moab::SimpleStat< T > Struct Template Reference

List of all members.

Public Member Functions

 SimpleStat ()
void add (T value)
double avg () const
double rms () const
double dev () const

Public Attributes

T min
T max
T sum
T sqr
size_t count

Detailed Description

template<typename T>
struct moab::SimpleStat< T >

Definition at line 2114 of file AdaptiveKDTree.cpp.


Constructor & Destructor Documentation

template<typename T >
moab::SimpleStat< T >::SimpleStat ( )

Definition at line 2125 of file AdaptiveKDTree.cpp.

            : min(  std::numeric_limits<T>::max() ),
              max(  std::numeric_limits<T>::min() ),
              sum( 0 ), sqr( 0 ), count( 0 )
    {}

Member Function Documentation

template<typename T >
void moab::SimpleStat< T >::add ( T  value)

Definition at line 2131 of file AdaptiveKDTree.cpp.

    {
      if (value < min)
        min = value;
      if (value > max)
        max = value;
      sum += value;
      sqr += value*value;
      ++count;
    }
template<typename T>
double moab::SimpleStat< T >::avg ( ) const [inline]

Definition at line 2120 of file AdaptiveKDTree.cpp.

{ return (double)sum / count; }
template<typename T>
double moab::SimpleStat< T >::dev ( ) const [inline]

Definition at line 2122 of file AdaptiveKDTree.cpp.

{ return (count > 1 ? sqrt( (count * (double)sqr - (double)sum * (double)sum) / ((double)count * (count - 1) ) ) : 0.0); }
template<typename T>
double moab::SimpleStat< T >::rms ( ) const [inline]

Definition at line 2121 of file AdaptiveKDTree.cpp.

{ return sqrt( (double)sqr / count ); }

Member Data Documentation

template<typename T>
size_t moab::SimpleStat< T >::count

Definition at line 2117 of file AdaptiveKDTree.cpp.

template<typename T>
T moab::SimpleStat< T >::max

Definition at line 2116 of file AdaptiveKDTree.cpp.

template<typename T>
T moab::SimpleStat< T >::min

Definition at line 2116 of file AdaptiveKDTree.cpp.

template<typename T>
T moab::SimpleStat< T >::sqr

Definition at line 2116 of file AdaptiveKDTree.cpp.

template<typename T>
T moab::SimpleStat< T >::sum

Definition at line 2116 of file AdaptiveKDTree.cpp.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines