Struct nalgebra_mvn::MultivariateNormal

source ·
pub struct MultivariateNormal<Real, N>
where Real: RealField, N: Dim + DimMin<N, Output = N>, DefaultAllocator: Allocator<Real, N> + Allocator<Real, N, N> + Allocator<Real, U1, N> + Allocator<(usize, usize), <N as DimMin<N>>::Output>,
{ /* private fields */ }
Expand description

An N-dimensional multivariate normal distribution

See the crate-level docs for example usage.

Implementations§

source§

impl<Real, N> MultivariateNormal<Real, N>
where Real: RealField, N: Dim + DimMin<N, Output = N> + DimSub<Dyn>, DefaultAllocator: Allocator<Real, N> + Allocator<Real, N, N> + Allocator<Real, U1, N> + Allocator<(usize, usize), <N as DimMin<N>>::Output>,

source

pub fn from_mean_and_precision( mu: &OVector<Real, N>, precision: &OMatrix<Real, N, N> ) -> Self

Create a multivariate normal distribution from a mean and precision

The mean vector mu is N dimensional and the precision matrix is N x N.

source

pub fn from_mean_and_covariance( mu: &OVector<Real, N>, covariance: &OMatrix<Real, N, N> ) -> Result<Self, Error>

Create a multivariate normal distribution from a mean and covariance

The mean vector mu is N dimensional and the covariance matrix is N x N.

The precision matrix is calculated by inverting the covariance matrix using a Cholesky decomposition. This can fail if the covariance matrix is not definite positive.

source

pub fn mean(&self) -> OVector<Real, N>

Get the mean of the distribution

source

pub fn precision(&self) -> &OMatrix<Real, N, N>

Get the precision of the distribution

source

pub fn pdf<Count>(&self, xs: &OMatrix<Real, Count, N>) -> OVector<Real, Count>
where Count: Dim, DefaultAllocator: Allocator<Real, Count> + Allocator<Real, N, Count> + Allocator<Real, Count, N> + Allocator<Real, Count, Count>,

Probability density function

Evaluate the probability density at locations xs.

source

pub fn logpdf<Count>( &self, xs: &OMatrix<Real, Count, N> ) -> OVector<Real, Count>
where Count: Dim, DefaultAllocator: Allocator<Real, Count> + Allocator<Real, N, Count> + Allocator<Real, Count, N> + Allocator<Real, Count, Count>,

Log of the probability density function

Evaluate the log probability density at locations xs.

Trait Implementations§

source§

impl<Real, N> Clone for MultivariateNormal<Real, N>
where Real: RealField + Clone, N: Dim + DimMin<N, Output = N> + Clone, DefaultAllocator: Allocator<Real, N> + Allocator<Real, N, N> + Allocator<Real, U1, N> + Allocator<(usize, usize), <N as DimMin<N>>::Output>,

source§

fn clone(&self) -> MultivariateNormal<Real, N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Real, N> Debug for MultivariateNormal<Real, N>
where Real: RealField + Debug, N: Dim + DimMin<N, Output = N> + Debug, DefaultAllocator: Allocator<Real, N> + Allocator<Real, N, N> + Allocator<Real, U1, N> + Allocator<(usize, usize), <N as DimMin<N>>::Output>,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Real, N> !Freeze for MultivariateNormal<Real, N>

§

impl<Real, N> !RefUnwindSafe for MultivariateNormal<Real, N>

§

impl<Real, N> !Send for MultivariateNormal<Real, N>

§

impl<Real, N> !Sync for MultivariateNormal<Real, N>

§

impl<Real, N> !Unpin for MultivariateNormal<Real, N>

§

impl<Real, N> !UnwindSafe for MultivariateNormal<Real, N>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.