Gromacs
2024.3
|
#include <gromacs/math/include/gromacs/math/exponentialmovingaverage.h>
Evaluate the exponential moving average with bias correction.
The exponential moving average at the 0th data point is and at the n-th data point with n>0 it is , where the smoothing factor is determined via a time constant .
To avoid large impact of the first data point in a "burn-in" phase, the weight of points are unbiased by substituting for above, .
Public Member Functions | |
ExponentialMovingAverage (real timeConstant, const ExponentialMovingAverageState &state={}) | |
Construct by setting the time constant and state. Allows reinitiating with data from memory. More... | |
void | updateWithDataPoint (real dataPoint) |
Update the moving average with a data point. | |
real | biasCorrectedAverage () const |
The exponential weighted average with bias correction. | |
bool | increasing () const |
Returns true if last added data point increased the average. | |
const ExponentialMovingAverageState & | state () const |
Return the current state of the exponential moving average. | |
real | inverseTimeConstant () const |
The inverse time constant for the exponential moving average. | |
gmx::ExponentialMovingAverage::ExponentialMovingAverage | ( | real | timeConstant, |
const ExponentialMovingAverageState & | state = {} |
||
) |
Construct by setting the time constant and state. Allows reinitiating with data from memory.
[in] | timeConstant | time in number of data points |
[in] | state | of the exponential moving average |
InconsistentInputError | if timeConstant < 1 |