GaussianPdf Class Reference

Inheritance diagram for GaussianPdf:

Inheritance graph
[legend]

List of all members.


Detailed Description

Multivariate Gaussian probability distribution.

Author:
Lawrence Murray <lawrence@indii.org>
Version:
Rev
Date:
Date

Serialization

This class supports serialization through the Boost.Serialization library. Two issues are worth noting.

Firstly, Boost.uBLAS has limited serialization support in its CVS snapshot at time of writing (3 Sep 2007). It appears limited to the serialization of basic vectors and matrices: symmetric matrices do not appear to be supported, for example.

Secondly, it's arguable whether serializing pre-calculations is useful or not. It makes for larger messages in a parallel environment, the cost of sending which may exceed the savings of the precalculations in the first place.

The implementation here takes the path of least resistance in both cases. We choose to use the limited Boost.uBLAS serialization features anyway for ease of implementation, presuming that eventually full serialization support will be provided. We also choose to serialize just the bare essentials, excluding pre-calculation results.

Definition at line 40 of file GaussianPdf.hpp.


Public Member Functions

 GaussianPdf ()
 Default constructor.
 GaussianPdf (const vector &mu, const symmetric_matrix &sigma)
 Construct Gaussian given mean and covariance.
 GaussianPdf (unsigned int N)
 Construct Gaussian given dimensionality.
GaussianPdfoperator= (const GaussianPdf &o)
 Assignment operator.
virtual ~GaussianPdf ()
 Destructor.
virtual void setDimensions (const unsigned int N, const bool preserve=false)
 Set the dimensionality of the distribution.
virtual const vectorgetExpectation () const
 Get the expected value of the distribution.
virtual const
symmetric_matrix
getCovariance () const
 Get the covariance of the distribution.
virtual const vectorgetExpectation ()
 Get the expected value of the distribution.
virtual const
symmetric_matrix
getCovariance ()
 Get the covariance of the distribution.
virtual void setExpectation (const vector &mu)
 Set the mean of the Gaussian.
virtual void setCovariance (const symmetric_matrix &sigma)
 Set the covariance of the Gaussian.
virtual vector sample ()
 Sample from the Gaussian.
double calculateDensity (const vector &x)
virtual double densityAt (const vector &x)
 Calculate the density at a given point.

Protected Member Functions

virtual void dirty ()
 Called when changes are made to the distribution, such as when the expectation or covariance is changed.

Constructor & Destructor Documentation

GaussianPdf (  ) 

Default constructor.

Initialises the Gaussian with zero dimensions. This should generally only be used when the object is to be restored from a serialization.

Definition at line 20 of file GaussianPdf.cpp.

GaussianPdf ( const vector mu,
const symmetric_matrix sigma 
)

Construct Gaussian given mean and covariance.

Parameters:
mu $\mathbf{\mu}$; mean of the Gaussian.
sigma $\Sigma$; covariance of the Gaussian.

Definition at line 26 of file GaussianPdf.cpp.

GaussianPdf ( unsigned int  N  ) 

Construct Gaussian given dimensionality.

The mean and covariance remain uninitialised, and should be set with setExpectation() and setCovariance().

Parameters:
N $N$; number of dimensions of the Gaussian.

Definition at line 40 of file GaussianPdf.cpp.

~GaussianPdf (  )  [virtual]

Destructor.

Definition at line 81 of file GaussianPdf.cpp.


Member Function Documentation

GaussianPdf & operator= ( const GaussianPdf o  ) 

Assignment operator.

Both sides must have the same dimensionality.

Definition at line 46 of file GaussianPdf.cpp.

void setDimensions ( const unsigned int  N,
const bool  preserve = false 
) [virtual]

Set the dimensionality of the distribution.

Parameters:
N Dimensionality of the distribution.
preserve True to preserve the current sufficient statistics of the distribution in the lower dimensional space, false if these may be discarded.

Implements Pdf.

Definition at line 85 of file GaussianPdf.cpp.

const vector & getExpectation (  )  const [virtual]

Get the expected value of the distribution.

Returns:
$\mathbf{\mu}$; expected value of the distribution.

Definition at line 97 of file GaussianPdf.cpp.

const symmetric_matrix & getCovariance (  )  const [virtual]

Get the covariance of the distribution.

Returns:
$\Sigma$; covariance of the distribution.

Definition at line 101 of file GaussianPdf.cpp.

const vector & getExpectation (  )  [virtual]

Get the expected value of the distribution.

Returns:
$\mathbf{\mu}$; expected value of the distribution.

Implements Pdf.

Definition at line 105 of file GaussianPdf.cpp.

const symmetric_matrix & getCovariance (  )  [virtual]

Get the covariance of the distribution.

Returns:
$\Sigma$; covariance of the distribution.

Implements Pdf.

Definition at line 109 of file GaussianPdf.cpp.

void setExpectation ( const vector mu  )  [virtual]

Set the mean of the Gaussian.

The new mean vector must have the same size as the previous one.

Parameters:
mu $\mathbf{\mu}$; mean of the Gaussian.

Definition at line 113 of file GaussianPdf.cpp.

void setCovariance ( const symmetric_matrix sigma  )  [virtual]

Set the covariance of the Gaussian.

The new covariance matrix must have the same size as the previous one.

Parameters:
sigma $\Sigma$; covariance of the Gaussian.

Definition at line 121 of file GaussianPdf.cpp.

vector sample (  )  [virtual]

Sample from the Gaussian.

Returns:
The sample $\mathbf{x}$

Implements Pdf.

Definition at line 129 of file GaussianPdf.cpp.

double calculateDensity ( const vector x  ) 

Deprecated:
Use densityAt() instead.

Definition at line 188 of file GaussianPdf.cpp.

double densityAt ( const vector x  )  [virtual]

Calculate the density at a given point.

\[p(\mathbf{x}) = \frac{1}{\sqrt{(2\pi)^N|\Sigma|}} \exp\big({-\frac{1}{2}(\mathbf{x}-\mathbf{\mu})^T \Sigma^{-1} (\mathbf{x}-\mathbf{\mu})\big)} \]

Parameters:
x $\mathbf{x}$; point at which to evaluate the density.
Returns:
$p(\mathbf{x})$; the density at $\mathbf{x}$.

Implements Pdf.

Definition at line 147 of file GaussianPdf.cpp.

void dirty (  )  [protected, virtual]

Called when changes are made to the distribution, such as when the expectation or covariance is changed.

This allows pre-calculations to be refreshed.

Definition at line 180 of file GaussianPdf.cpp.


Generated on Wed Dec 17 15:11:58 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3