MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::SimpleStats Class Reference

Accumulate various statistics for a list of discrete values. More...

#include <SimpleStats.hpp>

Public Member Functions

 SimpleStats ()
double minimum () const
 minimum value
double maximum () const
 maximum value
double average () const
 algebraic mean of values
double rms () const
 root mean squared of values
double variance () const
 variance of values
double standard_deviation () const
 standard deviation of values
void add_value (double value)
 incorporate another value into statistics
void add_squared (double value_squared)
 incorporate another value into statistics
void clear ()
bool empty ()

Private Attributes

double valueSum
double valueSqrSum
double valueMin
double valueMax
unsigned long valueCount

Detailed Description

Accumulate various statistics for a list of discrete values.

Definition at line 41 of file SimpleStats.hpp.


Constructor & Destructor Documentation

Definition at line 38 of file SimpleStats.cpp.

    : valueSum( 0 ), valueSqrSum( 0 ), valueMin( std::numeric_limits< double >::infinity() ),
      valueMax( -std::numeric_limits< double >::infinity() ), valueCount( 0 )
{
}

Member Function Documentation

void MBMesquite::SimpleStats::add_squared ( double  value_squared) [inline]

incorporate another value into statistics

Definition at line 92 of file SimpleStats.hpp.

References value(), valueCount, valueMax, valueMin, valueSqrSum, and valueSum.

Referenced by MBMesquite::MeshUtil::edge_length_distribution().

    {
        double value = sqrt( value_squared );
        valueSum += value;
        valueSqrSum += value_squared;
        if( value < valueMin ) valueMin = value;
        if( value > valueMax ) valueMax = value;
        ++valueCount;
    }
void MBMesquite::SimpleStats::add_value ( double  value) [inline]

incorporate another value into statistics

Definition at line 82 of file SimpleStats.hpp.

References value(), valueCount, valueMax, valueMin, valueSqrSum, and valueSum.

Referenced by MBMesquite::CompareQM::GradStat::add(), MBMesquite::CompareQM::check_value(), and MBMesquite::MeshUtil::lambda_distribution().

    {
        valueSum += value;
        valueSqrSum += value * value;
        if( value < valueMin ) valueMin = value;
        if( value > valueMax ) valueMax = value;
        ++valueCount;
    }

Definition at line 44 of file SimpleStats.cpp.

References valueCount, valueMax, valueMin, valueSqrSum, and valueSum.

Referenced by MeshUtilTest::test_lambda_distribution().

{
    valueSum = valueSqrSum = 0;
    valueMin               = std::numeric_limits< double >::infinity();
    valueMax               = -valueMin;
    valueCount             = 0;
}
double MBMesquite::SimpleStats::variance ( ) const [inline]

variance of values

Definition at line 71 of file SimpleStats.hpp.

References average(), valueCount, and valueSqrSum.

Referenced by standard_deviation(), and MeshUtilTest::test_lambda_distribution().

    {
        return valueSqrSum / valueCount - average() * average();
    }

Member Data Documentation

unsigned long MBMesquite::SimpleStats::valueCount [private]

Definition at line 45 of file SimpleStats.hpp.

Referenced by add_squared(), add_value(), average(), clear(), empty(), rms(), and variance().

Definition at line 44 of file SimpleStats.hpp.

Referenced by add_squared(), add_value(), clear(), and maximum().

Definition at line 44 of file SimpleStats.hpp.

Referenced by add_squared(), add_value(), clear(), and minimum().

Definition at line 44 of file SimpleStats.hpp.

Referenced by add_squared(), add_value(), clear(), rms(), and variance().

Definition at line 44 of file SimpleStats.hpp.

Referenced by add_squared(), add_value(), average(), and clear().

List of all members.


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