MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::SimpleStat< T > Struct Template Reference

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 2093 of file AdaptiveKDTree.cpp.


Constructor & Destructor Documentation

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

Definition at line 2116 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 SimpleStat< T >::add ( T  value)

Definition at line 2122 of file AdaptiveKDTree.cpp.

References moab::sum().

Referenced by moab::AdaptiveKDTree::print().

{
    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 2099 of file AdaptiveKDTree.cpp.

References moab::sum().

Referenced by moab::AdaptiveKDTree::print().

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

Definition at line 2107 of file AdaptiveKDTree.cpp.

References moab::sum().

Referenced by moab::AdaptiveKDTree::print().

    {
        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 2103 of file AdaptiveKDTree.cpp.

Referenced by moab::AdaptiveKDTree::print().

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

Member Data Documentation

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

Definition at line 2095 of file AdaptiveKDTree.cpp.

Referenced by moab::AdaptiveKDTree::print().

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

Definition at line 2095 of file AdaptiveKDTree.cpp.

Referenced by moab::AdaptiveKDTree::print().

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

Definition at line 2095 of file AdaptiveKDTree.cpp.

Referenced by SimpleStat< T >::dev(), and SimpleStat< T >::rms().

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

List of all members.


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