shark::MultiVariateNormalDistribution Class Reference

Implements a multi-variate normal distribution with zero mean. More...

#include <shark/Statistics/Distributions/MultiVariateNormalDistribution.h>

Public Member Functions

 MultiVariateNormalDistribution (RealMatrix const &Sigma)
 Constructor. More...
 
 MultiVariateNormalDistribution ()
 Constructor. More...
 
template<typename Archive >
void serialize (Archive &ar, const std::size_t version)
 Stores/Restores the distribution from the supplied archive. More...
 
void resize (std::size_t size)
 Resizes the distribution. Updates both eigenvectors and eigenvalues. More...
 
RealMatrix const & covarianceMatrix () const
 Accesses the covariance matrix defining the distribution. More...
 
RealMatrix & covarianceMatrix ()
 Accesses a mutable reference to the covariance matrix defining the distribution. Allows for l-value semantics. More...
 
void setCovarianceMatrix (RealMatrix const &matrix)
 Sets the covariance matrix and updates the internal variables. This is expensive. More...
 
RealMatrix const & eigenVectors () const
 Accesses an immutable reference to the eigenvectors of the covariance matrix. More...
 
RealVector const & eigenValues () const
 Accesses an immutable reference to the eigenvalues of the covariance matrix. More...
 
template<class randomType >
result_type operator() (randomType &rng) const
 Samples the distribution. More...
 
void update ()
 Calculates the evd of the current covariance matrix. More...
 

Detailed Description

Implements a multi-variate normal distribution with zero mean.

Definition at line 40 of file MultiVariateNormalDistribution.h.

Constructor & Destructor Documentation

◆ MultiVariateNormalDistribution() [1/2]

shark::MultiVariateNormalDistribution::MultiVariateNormalDistribution ( RealMatrix const &  Sigma)
inline

Constructor.

Parameters
[in]Sigmacovariance matrix

Definition at line 51 of file MultiVariateNormalDistribution.h.

References update().

◆ MultiVariateNormalDistribution() [2/2]

shark::MultiVariateNormalDistribution::MultiVariateNormalDistribution ( )
inline

Constructor.

Definition at line 57 of file MultiVariateNormalDistribution.h.

Member Function Documentation

◆ covarianceMatrix() [1/2]

RealMatrix const& shark::MultiVariateNormalDistribution::covarianceMatrix ( ) const
inline

Accesses the covariance matrix defining the distribution.

Definition at line 76 of file MultiVariateNormalDistribution.h.

Referenced by shark::CMA::covarianceMatrix(), and setCovarianceMatrix().

◆ covarianceMatrix() [2/2]

RealMatrix& shark::MultiVariateNormalDistribution::covarianceMatrix ( )
inline

Accesses a mutable reference to the covariance matrix defining the distribution. Allows for l-value semantics.

ATTENTION: If the reference is altered, update needs to be called manually.

Definition at line 84 of file MultiVariateNormalDistribution.h.

◆ eigenValues()

RealVector const& shark::MultiVariateNormalDistribution::eigenValues ( ) const
inline

Accesses an immutable reference to the eigenvalues of the covariance matrix.

Definition at line 100 of file MultiVariateNormalDistribution.h.

Referenced by shark::CMA::condition(), and shark::CMA::eigenValues().

◆ eigenVectors()

RealMatrix const& shark::MultiVariateNormalDistribution::eigenVectors ( ) const
inline

Accesses an immutable reference to the eigenvectors of the covariance matrix.

Definition at line 95 of file MultiVariateNormalDistribution.h.

Referenced by shark::CMA::eigenVectors().

◆ operator()()

template<class randomType >
result_type shark::MultiVariateNormalDistribution::operator() ( randomType &  rng) const
inline

Samples the distribution.

Definition at line 106 of file MultiVariateNormalDistribution.h.

References shark::random::gauss().

◆ resize()

void shark::MultiVariateNormalDistribution::resize ( std::size_t  size)
inline

Resizes the distribution. Updates both eigenvectors and eigenvalues.

Parameters
[in]sizeThe new size of the distribution

Definition at line 70 of file MultiVariateNormalDistribution.h.

References update().

Referenced by main().

◆ serialize()

template<typename Archive >
void shark::MultiVariateNormalDistribution::serialize ( Archive &  ar,
const std::size_t  version 
)
inline

Stores/Restores the distribution from the supplied archive.

Parameters
[in,out]arThe archive to read from/write to.
[in]versionCurrently unused.

Definition at line 63 of file MultiVariateNormalDistribution.h.

◆ setCovarianceMatrix()

void shark::MultiVariateNormalDistribution::setCovarianceMatrix ( RealMatrix const &  matrix)
inline

Sets the covariance matrix and updates the internal variables. This is expensive.

Definition at line 89 of file MultiVariateNormalDistribution.h.

References covarianceMatrix(), and update().

Referenced by shark::MultiVariateNormalDistributionCholesky::MultiVariateNormalDistributionCholesky().

◆ update()

void shark::MultiVariateNormalDistribution::update ( )
inline

Calculates the evd of the current covariance matrix.

Definition at line 118 of file MultiVariateNormalDistribution.h.

Referenced by MultiVariateNormalDistribution(), resize(), and setCovarianceMatrix().


The documentation for this class was generated from the following file: