Template Class MultivariateNormalDistribution

Class Documentation

template<class T>
class MultivariateNormalDistribution

Multivariate normal distribution.

MultivariateNormalDistribution<T> is an implementation of Beluga named requirements: RandomStateDistribution that represents a multi-dimensional normal distribution of real-valued random variables.

Template Parameters:

T – The result type for the distribution.

Public Types

using scalar_type = typename multivariate_distribution_traits<T>::scalar_type

The scalar type.

using vector_type = typename multivariate_distribution_traits<T>::vector_type

The Eigen vector type corresponding to T.

using covariance_type = typename multivariate_distribution_traits<T>::covariance_type

The covariance matrix from T.

using result_type = typename multivariate_distribution_traits<T>::result_type

The result type from T.

using param_type = MultivariateNormalDistributionParam<vector_type, covariance_type>

The type of the parameter set.

Public Functions

MultivariateNormalDistribution() = default

Construct with zero mean and circularly symmetric unitary covariance.

inline explicit MultivariateNormalDistribution(const param_type &params)

Construct from distribution parameters.

Parameters:

params – The distribution parameter set.

inline explicit MultivariateNormalDistribution(covariance_type covariance)

Construct with zero mean and the given covariance.

Parameters:

covariance – Real symmetric matrix that represents the covariance of the random variable.

Throws:

std::runtime_error – If the provided covariance is invalid.

inline MultivariateNormalDistribution(result_type mean, covariance_type covariance)

Construct with the given mean and covariance.

Parameters:
  • mean – An object that represents the mean value of the random variable.

  • covariance – Real symmetric matrix that represents the covariance of the random variable.

Throws:

std::runtime_error – If the provided covariance is invalid.

template<class U>
inline MultivariateNormalDistribution(const MultivariateNormalDistribution<U> &other)

Copy construct from another compatible distribution.

Template Parameters:

U – The result type for the other distribution.

Parameters:

other – Another instance of a multivariate normal distribution.

template<class U>
inline MultivariateNormalDistribution(MultivariateNormalDistribution<U> &&other) noexcept

Move construct from another compatible distribution.

Template Parameters:

U – The result type for the other distribution.

Parameters:

other – Another instance of a multivariate normal distribution.

template<class U>
inline MultivariateNormalDistribution &operator=(const MultivariateNormalDistribution<U> &other)

Copy assign from another compatible distribution.

Template Parameters:

U – The result type for the other distribution.

Parameters:

other – Another instance of a multivariate normal distribution.

template<class U>
inline MultivariateNormalDistribution &operator=(MultivariateNormalDistribution<U> &&other)

Move assign from another compatible distribution.

Template Parameters:

U – The result type for the other distribution.

Parameters:

other – Another instance of a multivariate normal distribution.

inline void reset()

Resets the internal state of the distribution.

inline const param_type &param() const

Returns the associated parameter set.

inline void param(const param_type &params)

Sets the associated parameter set to params.

This doesn’t reset the internal state of the distribution.

Parameters:

params – New contents of the associated parameter set.

template<class Generator>
inline result_type operator()(Generator &generator)

Generates the next random object in the distribution.

Template Parameters:

Generator – The generator type that must meet the requirements of UniformRandomBitGenerator.

Parameters:

generator – An uniform random bit generator object.

Returns:

The generated random object.

template<class Generator>
inline result_type operator()(Generator &generator, const param_type &params)

Generates the next random object in the distribution.

Template Parameters:

Generator – The generator type that must meet the requirements of UniformRandomBitGenerator.

Parameters:
  • generator – An uniform random bit generator object.

  • params – Distribution parameter set to use instead of the associated one.

Returns:

The generated random object.

inline bool operator==(const MultivariateNormalDistribution<T> &other) const

Compares this object with other distribution object.

Two distribution objects are equal when parameter values and internal state are the same. In other words, if they are invoked with equal generators, they generate the same sequence.

Parameters:

other – Distribution object to compare against.

Returns:

True if the objects are equal, false otherwise.

inline bool operator!=(const MultivariateNormalDistribution<T> &other) const

Compares this object with other distribution object.

Two distribution objects are equal when parameter values and internal state are the same. In other words, if they are invoked with equal generators, they generate the same sequence.

Parameters:

other – Distribution object to compare against.

Returns:

True if the objects are not equal, false otherwise.

Friends

friend class MultivariateNormalDistribution