yat
0.20.3pre
|
Base class for averager classes. More...
#include <yat/statistics/averager_base.h>
Public Member Functions | |
averager_base (void) | |
Constructor. | |
virtual | ~averager_base (void)=0 |
Destructor. | |
void | add (double x, long n=1) |
add a data point More... | |
double | mean (void) const |
mean More... | |
long | n (void) const |
number of data points More... | |
void | rescale (double a) |
Rescales the object. More... | |
void | reset (void) |
Reset object. More... | |
double | sum_x (void) const |
Protected Member Functions | |
void | add1 (double x, long int n) |
void | add1 (double delta) |
double | rescale1 (double x) |
Protected Attributes | |
long int | n_ |
double | mean_ |
mean | |
Base class for averager classes.
This is a base class templated on the derived class (see curiously recurring template pattern), which implies there is no dynamic polymorphism but the concrete type must be decided at compile time.
The derived class, MyClass
, needs to have the following features:
DefaultConstructible
Assignablea
function add_impl(double, long int)a
function rescale_impl(double)These two functions need to be public or if you dont want to expose them to the world, make them private and declare averager_base<Derived>
as friend.
A derived class is typically declared as
|
inline |
add a data point
Adding n number of data point(s) with value x.
|
protected |
add n data points with value x
|
protected |
add one data point with value delta + mean()
|
inline |
mean
|
inline |
number of data points
|
inline |
Rescales the object.
,
|
protected |
rescale as
|
inline |
Reset object.
Restore Averager as if data were never added
|
inline |
|
protected |
number of data points