Template Class RollingMeanAccumulator

Class Documentation

template<typename T>
class RollingMeanAccumulator

Computes the mean of the last accumulated elements.

This is a simplified version of boost’s rolling mean accumulator, written to avoid dragging in boost dependencies.

Public Functions

inline explicit RollingMeanAccumulator(size_t rolling_window_size)

Constructs the rolling mean accumulator with a specified window size.

Parameters:

rolling_window_size[in] The unsigned integral length of the accumulator’s window length.

inline void accumulate(T val)

Collects the provided value in the accumulator’s buffer.

Parameters:

val[in] The value to accumulate.

inline T getRollingMean() const

Calculates the rolling mean accumulated insofar.

Returns:

Rolling mean of the accumulated values.