# Struct ema::StableEma [−][src]

`pub struct StableEma<F> where`

F: Float, { /* fields omitted */ }

## Expand description

A stable Ema where the `recent_weight`

is set at initialization and the same value is always used.

## Implementations

Returns a new `StableEma`

with the `mean`

, `variance`

, and `recent_weight`

all initialized.

It is recommended to choose the `mean`

and `variance`

to be as close to expected as possible so that they can converge quickly

`pub fn try_new<T: TryInto<NotNan<F>, Error = FloatIsNan>>(`

mean: T,

variance: T,

recent_weight: T

) -> Result<Self, FloatIsNan>

`pub fn try_new<T: TryInto<NotNan<F>, Error = FloatIsNan>>(`

mean: T,

variance: T,

recent_weight: T

) -> Result<Self, FloatIsNan>

Tries to create a new `StableEma`

from raw float values.

# Errors

Fails if `mean`

, `variance`

, or `recent_weight`

are NaN

Accumulates the value to this `StableEma`

Returns the recent weight that this `StableEma`

uses to accumulate values

Returns the mean of this `StableEma`

as a duration in seconds. Useful when using an `Ema`

to time events.

Returns the standard deviation of this `StableEma`

as a duration in seconds. Useful when using an `Ema`

to time events.

Change the recent weight.

# Safety

This is not unsafe to call, but it violates the notion that this has a stable recent weight

## 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 StableEma<F> where`

F: RefUnwindSafe,

`impl<F> UnwindSafe for StableEma<F> where`

F: UnwindSafe,

## Blanket Implementations

Mutably borrows from an owned value. Read more