faunus
Public Member Functions | Friends | List of all members
Faunus::AverageStdev< value_type, counter_type > Class Template Reference

Class to collect averages and standard deviation. More...

#include <average.h>

Inheritance diagram for Faunus::AverageStdev< value_type, counter_type >:
Inheritance graph
[legend]
Collaboration diagram for Faunus::AverageStdev< value_type, counter_type >:
Collaboration graph
[legend]

Public Member Functions

void clear ()
 Clear all data.
 
auto rms () const
 Root-mean-square.
 
auto rsd () const
 Relative standard deviation or coefficient of variation.
 
value_type stdev () const
 Standard deviation.
 
void add (const value_type value)
 Add value to average. More...
 
AverageStdevoperator+= (const value_type value)
 Add value to average. More...
 
bool operator== (const AverageStdev &other) const
 
AverageStdevoperator= (const value_type value)
 Clear and assign a new value.
 
AverageStdevoperator<< (std::istream &stream)
 
template<class Archive >
void serialize (AverageStdev &archive)
 
- Public Member Functions inherited from Faunus::Average< value_type, counter_type >
void clear ()
 Clear all data.
 
bool empty () const
 True if empty.
 
auto size () const
 Number of samples.
 
auto avg () const
 Average.
 
 operator value_type () const
 Static cast operator.
 
bool operator< (const Average &other) const
 Compare means.
 
 operator bool () const
 Check if not empty.
 
void add (const value_type value)
 Add value to average. More...
 
Averageoperator+= (const value_type value)
 Add value to average. More...
 
bool operator== (const Average &other) const
 
Averageoperator= (const value_type value)
 Clear and assign a new value.
 
auto operator+ (const Average &other) const
 Merge two averages with correct weights. More...
 
Averageoperator<< (std::istream &stream)
 
template<class Archive >
void serialize (Archive &archive)
 

Friends

std::ostream & operator<< (std::ostream &stream, const AverageStdev &average)
 

Additional Inherited Members

- Protected Attributes inherited from Faunus::Average< value_type, counter_type >
counter_type number_of_samples = 0
 number of values in average
 
value_type value_sum = 0.0
 Sum of all recorded values.
 

Detailed Description

template<std::floating_point value_type = double, std::unsigned_integral counter_type = unsigned long int>
class Faunus::AverageStdev< value_type, counter_type >

Class to collect averages and standard deviation.

Todo:
inherit from Average

Member Function Documentation

◆ add()

template<std::floating_point value_type = double, std::unsigned_integral counter_type = unsigned long int>
void Faunus::AverageStdev< value_type, counter_type >::add ( const value_type  value)
inline

Add value to average.

Parameters
valueValue to add
Exceptions
Ifcounter overflow

◆ operator+=()

template<std::floating_point value_type = double, std::unsigned_integral counter_type = unsigned long int>
AverageStdev& Faunus::AverageStdev< value_type, counter_type >::operator+= ( const value_type  value)
inline

Add value to average.

Parameters
valueValue to add
Exceptions
Ifoverflow in either the counter, or sum of squared values

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