Struct ema::Ema [−][src]
pub struct Ema<F> where
F: Float, { /* fields omitted */ }
Expand description
A struct representing an exponential moving average
The weighting can be chosen for each accumulation. To have the weighting be part of the struct see StableEma
Implementations
pub fn try_new(
mean: impl TryInto<NotNan<F>, Error = FloatIsNan>,
variance: impl TryInto<NotNan<F>, Error = FloatIsNan>
) -> Result<Self, FloatIsNan>
pub fn try_new(
mean: impl TryInto<NotNan<F>, Error = FloatIsNan>,
variance: impl TryInto<NotNan<F>, Error = FloatIsNan>
) -> Result<Self, FloatIsNan>
Returns a new Ema
struct with the mean and variance estimates already initialized.
It is recommended to choose these values to be as close to expected as possible so that they can converge quickly
Accumulates a new value into this Ema
. The mean and variance are adjusted by the recent_weight
Returns the mean of this Ema
as a duration in seconds. Useful when using an Ema
to time events.
Returns the standard deviation of this Ema
as a duration in seconds. Useful when using an Ema
to time events
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<F> RefUnwindSafe for Ema<F> where
F: RefUnwindSafe,
impl<F> UnwindSafe for Ema<F> where
F: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more