GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::ExponentialMovingAverage< T > Class Template Reference

Exponential moving average of a discrete-time input signal. More...

#include <GREM/core/statistics.hpp>

Public Member Functions

constexpr ExponentialMovingAverage ()=default
 Default-construct an exponential moving average.
constexpr ExponentialMovingAverage (T value)
 Construct an exponential moving average with a specific initial value.
constexpr void reset (T newValue={})
 Reset the exponential moving average to a specific value.
template<typename Coefficient>
constexpr T update (T newSignalValue, Coefficient alpha)
 Update the exponential moving average given the next discrete input signal sample value.
constexpr T get () const
 Get the current exponential moving average value.

Detailed Description

template<typename T>
class grem::ExponentialMovingAverage< T >

Exponential moving average of a discrete-time input signal.

Template Parameters
Tsignal value type. Must be a type that behaves like a number.

Constructor & Destructor Documentation

◆ ExponentialMovingAverage() [1/2]

template<typename T>
grem::ExponentialMovingAverage< T >::ExponentialMovingAverage ( )
constexprdefault

Default-construct an exponential moving average.

◆ ExponentialMovingAverage() [2/2]

template<typename T>
grem::ExponentialMovingAverage< T >::ExponentialMovingAverage ( T value)
inlineexplicitconstexpr

Construct an exponential moving average with a specific initial value.

Parameters
valueinitial value to set the exponential moving average to.

Member Function Documentation

◆ reset()

template<typename T>
void grem::ExponentialMovingAverage< T >::reset ( T newValue = {})
inlineconstexpr

Reset the exponential moving average to a specific value.

Parameters
newValuenew value to set the exponential moving average to.

◆ update()

template<typename T>
template<typename Coefficient>
T grem::ExponentialMovingAverage< T >::update ( T newSignalValue,
Coefficient alpha )
inlineconstexpr

Update the exponential moving average given the next discrete input signal sample value.

Parameters
newSignalValuenew sample value of the input signal.
alphaamount of the new value that is contributed to the average. Must be between 0 and 1 (inclusive).
Returns
the new exponential moving average of the input signal.

◆ get()

template<typename T>
T grem::ExponentialMovingAverage< T >::get ( ) const
inlinenodiscardconstexpr

Get the current exponential moving average value.

Returns
the current exponential moving average of the input signal.

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