pub struct SMM { /* private fields */ }
Expand description
Simple Moving Median of specified length
for timeseries of type ValueType
Parameters
Has a single parameter length
: PeriodType
length
should be > 0
Input type
Input type is ValueType
Output type
Output type is ValueType
Examples
use yata::prelude::*;
use yata::methods::SMM;
// SMM of length=3
let mut smm = SMM::new(3, &1.0).unwrap();
smm.next(&1.0);
smm.next(&2.0);
assert_eq!(smm.next(&3.0), 2.0);
assert_eq!(smm.next(&100.0), 3.0);
Performance
O(log(length
))
This method is relatively slower compare to the most of the other methods.
Implementations
Returns inner Window
. Useful for implementing in other methods and indicators.
👎 Deprecated since 0.5.1: Use Peekable::peek
instead
Use Peekable::peek
instead
Returns last result value. Useful for implementing in other methods and indicators.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
type Params = PeriodType
type Params = PeriodType
Method parameters
Static method for creating an instance of the method with given parameters
and initial value
(simply first input value)
Generates next output value based on the given input value
Creates an instance of the method with given parameters
and initial value
, wrapped by historical data holder
Creates an instance of the method with given parameters
and initial value
, wrapped by last produced value holder
Returns memory size of the method (size, align)
Iterates the Method
over the given inputs
slice and returns Vec
of output values. Read more
Applies method to the sequence in-place.
Creates new Method
instance and iterates it over the given inputs
slice and returns Vec
of output values. Read more
Creates new Method
instance and applies it to the sequence
.
Creates a function from the Method
instance
Auto Trait Implementations
impl RefUnwindSafe for SMM
impl UnwindSafe for SMM
Blanket Implementations
Mutably borrows from an owned value. Read more