[][src]Struct rstat::SimplexVector

pub struct SimplexVector(_);

Probability vector constrainted to the unit simplex.

Methods

impl SimplexVector[src]

pub fn new(ps: Vec<f64>) -> Result<SimplexVector, Error>[src]

Construct a new probability vector on the unit simplex.

pub fn new_unchecked<I>(ps: I) -> SimplexVector where
    I: IntoIterator<Item = f64>, 
[src]

Construct a new probability vector without enforcing constraints.

pub fn unwrap(self) -> Vec<f64>[src]

Unwrap and return the inner Vec<f64> instance.

pub fn sample_index<R: Rng + ?Sized>(&self, rng: &mut R) -> usize[src]

Sample a probability-weighted random index from the vector.

Trait Implementations

impl Clone for SimplexVector[src]

impl Debug for SimplexVector[src]

impl Deref for SimplexVector[src]

type Target = [f64]

The resulting type after dereferencing.

impl Param for SimplexVector[src]

type Value = Vec<f64>

impl TryFrom<Vec<f64>> for SimplexVector[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,