Sequence

Trait Sequence 

Source
pub trait Sequence<T: Num + PartialOrd + Copy + FromPrimitive + ToPrimitive> {
    // Required methods
    fn seq(start: T, end: T, step: T) -> Vec<T>;
    fn rep(x: T, n: usize) -> Vec<T>;
    fn linspace(start: T, end: T, n: usize) -> Vec<T>;
    fn logspace(start: T, end: T, n: usize) -> Vec<T>;
    fn cumsum(v: &[T]) -> Vec<T>;
}
Expand description

Trait for generating sequences of numbers.

Required Methods§

Source

fn seq(start: T, end: T, step: T) -> Vec<T>

Generate a sequence of numbers from start to end with a step size of step.

Source

fn rep(x: T, n: usize) -> Vec<T>

Repeat a number x, n times.

Source

fn linspace(start: T, end: T, n: usize) -> Vec<T>

Generate a sequence of numbers from start to end with n elements (linearly spaced).

Source

fn logspace(start: T, end: T, n: usize) -> Vec<T>

Generate a sequence of numbers from start to end with n elements (logarithmically spaced).

Source

fn cumsum(v: &[T]) -> Vec<T>

Compute the cumulative sum of a vector.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Sequence<T> for T