[][src]Struct loopybayesnet::LogProbVector

pub struct LogProbVector { /* fields omitted */ }

The representation of a probability vector in log-space

Log-space manipulation of probabilitys is stabler regarding vectors with values very close to 0 or 1. This uses the natural logarithm (base e).

The content of this log-proba vector may not be normalized: adding a constant value to all entries of the vector does not change the normalized probability it represents.

Methods

impl LogProbVector[src]

pub fn uniform(n: usize) -> LogProbVector[src]

Create an unnormalized log-probability vector representing an uniform distribution

pub fn deterministic(n: usize, i: usize) -> LogProbVector[src]

Create an unnormalized log-probability vector representing a deterministic distribution choosing value i from the n possible

If i >= n, this returns a vector assigning 0 probability to every value.

pub fn from_log_probabilities(log_probabilities: Array1<f32>) -> LogProbVector[src]

Wrap an array of log-probabilities into a log-probability vector

pub fn log_probabilities(&self) -> ArrayView1<f32>[src]

Access the underlying array of log-probas

pub fn as_probabilities(&self) -> Array1<f32>[src]

Get the normalized probabilities represented by this log-probability vector

pub fn renormalize(&mut self)[src]

Renormalize the log-probability vector so that its content represent exactly the log of a normalized probability distribution.

pub fn prod(&mut self, other: &LogProbVector)[src]

Multiply the given log-probability vector into this one.

NB: Multiplication is done in probability space, hence the log-probabilities are summed As a result, the log-probability vector will no longer be normalized if it was.

pub fn reset(&mut self)[src]

Resets this log-probas vector to a uniform distribution

Trait Implementations

impl Clone for LogProbVector[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for LogProbVector[src]

Auto Trait Implementations

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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