[−][src]Struct yata::methods::PivotSignal
Searches for Pivot Points over last left
+right
+1 values of type ValueType
Parameters
Has a tuple of 2 parameters (left
: PeriodType
, right
: PeriodType
)
left
should be > 0 and right
should be > 0
There is an additional restriction on parameters: left
+right
+1 should be <= PeriodType
::MAX.
So if your PeriodType
is default u8
, then left
+right
+1 should be <= 255
Input type
Input type is ValueType
Output type
Output type is Action
use yata::prelude::*; use yata::methods::PivotSignal; let s = [1.0, 2.0, 3.0, 2.0, 1.0, 1.0, 2.0]; let r = [ 0, 0, 1, 0, -1, 0, 1 ]; let mut pivot = PivotSignal::new(2, 2, s[0]); let r2: Vec<i8> = s.iter().map(|&v| pivot.next(v).analog()).collect(); assert_eq!(r2, r2);
Perfomance
O(left
+right
)
See also
Implementations
impl PivotSignal
[src]
pub fn new(left: PeriodType, right: PeriodType, value: ValueType) -> Self
[src]
Constructs new instanceof PivotSignal
It's just an alias for Method::new((left, right), value)
but without parentheses of Input
touple
Trait Implementations
impl Clone for PivotSignal
[src]
fn clone(&self) -> PivotSignal
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PivotSignal
[src]
impl Default for PivotSignal
[src]
fn default() -> PivotSignal
[src]
impl<'de> Deserialize<'de> for PivotSignal
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Method for PivotSignal
[src]
type Params = (PeriodType, PeriodType)
Method parameters
type Input = ValueType
Input value type
type Output = Action
Output value type
fn new(params: Self::Params, value: Self::Input) -> Self where
Self: Sized,
[src]
Self: Sized,
fn next(&mut self, value: ValueType) -> Self::Output
[src]
fn name(&self) -> &str
[src]
fn memsize(&self) -> (usize, usize) where
Self: Sized,
[src]
Self: Sized,
fn iter_data<I>(&mut self, input: I) -> MethodOverIterator<'_, Self, I> where
I: Iterator<Item = Self::Input>,
Self: Sized,
[src]
I: Iterator<Item = Self::Input>,
Self: Sized,
fn over<I>(&mut self, sequence: I) -> Sequence<Self::Output> where
I: Iterator<Item = Self::Input>,
Self: Sized,
[src]
I: Iterator<Item = Self::Input>,
Self: Sized,
impl Serialize for PivotSignal
[src]
Auto Trait Implementations
impl RefUnwindSafe for PivotSignal
impl Send for PivotSignal
impl Sync for PivotSignal
impl Unpin for PivotSignal
impl UnwindSafe for PivotSignal
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,