CFEL - ASG Software Suite  2.5.0
CASS
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
cass::MedianCalculator< Type > Class Template Reference

statistics calculator for a median More...

#include <statistics_calculator.hpp>

+ Collaboration diagram for cass::MedianCalculator< Type >:

Public Types

typedef Type value_type
 define the value type More...
 
typedef std::vector< value_typecontainer_type
 

Public Member Functions

 MedianCalculator ()
 default constructor More...
 
void addDatum (const value_type &datum)
 add a datum to the distribution More...
 
template<class InputIterator >
void addDistribution (InputIterator first, InputIterator last)
 add a number of dati to the distribution More...
 
value_type median () const
 retrieve the median of the distribution More...
 
void reset ()
 reset the statistics More...
 

Static Public Member Functions

static value_type median (const container_type &container)
 calculate the mean of a container_type container More...
 

Private Attributes

container_type _container
 the current mean value More...
 

Detailed Description

template<typename Type>
class cass::MedianCalculator< Type >

statistics calculator for a median

adds the datums to an internal vector, which is sorted using nth_element when getting the median.

Template Parameters
typeof the values for the average, defines the precision
Author
Lutz Foucar

Definition at line 471 of file statistics_calculator.hpp.

Member Typedef Documentation

template<typename Type>
typedef std::vector<value_type> cass::MedianCalculator< Type >::container_type

Definition at line 476 of file statistics_calculator.hpp.

template<typename Type>
typedef Type cass::MedianCalculator< Type >::value_type

define the value type

Definition at line 475 of file statistics_calculator.hpp.

Constructor & Destructor Documentation

template<typename Type>
cass::MedianCalculator< Type >::MedianCalculator ( )
inline

default constructor

resets the values.

Definition at line 482 of file statistics_calculator.hpp.

References cass::CummulativeStatisticsNoOutlier< Type >::reset().

Member Function Documentation

template<typename Type>
void cass::MedianCalculator< Type >::addDatum ( const value_type datum)
inline

add a datum to the distribution

Parameters
datumThe datum to be added

Definition at line 491 of file statistics_calculator.hpp.

References cass::CummulativeStatisticsNoOutlier< Type >::_container.

template<typename Type>
template<class InputIterator >
void cass::MedianCalculator< Type >::addDistribution ( InputIterator  first,
InputIterator  last 
)
inline

add a number of dati to the distribution

Adds all elements between first and last to the distribution, but not the last

Parameters
firstThe first in the range to be added
lastThe element after last to be added

Definition at line 505 of file statistics_calculator.hpp.

References cass::CummulativeStatisticsNoOutlier< Type >::addDatum().

Referenced by cass::pp333::medianCalc(), and cass::pp82::medianCalc().

template<typename Type>
value_type cass::MedianCalculator< Type >::median ( ) const
inline

retrieve the median of the distribution

uses median(const container_type &container) to calc the median

Returns
median of the distribution

Definition at line 517 of file statistics_calculator.hpp.

References cass::CummulativeStatisticsNoOutlier< Type >::_container.

Referenced by cass::pp333::medianCalc(), and cass::pp82::medianCalc().

template<typename Type>
static value_type cass::MedianCalculator< Type >::median ( const container_type container)
inlinestatic

calculate the mean of a container_type container

a static function so that one can use it without having an object of this class.

copy the container, sort the copied container and retrieve the central element

Returns
the median of the values inside the container
Parameters
containerthe container from whos values the median should be calculated

Definition at line 540 of file statistics_calculator.hpp.

template<typename Type>
void cass::MedianCalculator< Type >::reset ( )
inline

reset the statistics

Definition at line 523 of file statistics_calculator.hpp.

References cass::CummulativeStatisticsNoOutlier< Type >::_container.

Member Data Documentation

template<typename Type>
container_type cass::MedianCalculator< Type >::_container
private

the current mean value

Definition at line 551 of file statistics_calculator.hpp.


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