#include <gaussianDistribution.h>
Public Types | |
| typedef VectorType | vector_type |
| This public typedef indicates the vector type for the probability distributions. | |
Public Member Functions | |
| GaussianDistribution () | |
| Default constructor creates an uninitialized distribution. | |
| GaussianDistribution (const Array1D< double > &mean, const Array2D< double > &covariance) | |
| This constructor explicitly sets the mean, and covariance. | |
| GaussianDistribution (const GaussianDistribution< VectorType > &source) | |
| The copy constructor does a deep copy. | |
| ~GaussianDistribution () | |
| The destructor destroys the GaussianDistribution instance and cleans up any allocated storage. | |
| void | addSample (const VectorType &point) |
| This method adds a sample to the internal list of points from which to compute the distribution statistics. | |
| size_t | getCardinality () const |
| This member function returns the number of samples from which the current statistics are being estimated. | |
| const Array2D< double > & | getCovariance () const |
| This member function returns the covariance matrix of the distribution. | |
| const Array1D< double > & | getMean () const |
| This member function returns the mean of the distribution. | |
| void | setSampleData (const std::vector< VectorType > &sampleData) |
| This member function replaces the internal list of points from which to compute the distribution statistics. | |
| double | operator() (const VectorType &x) const |
| This member function returns the value of the Gaussian distribution evaluated at the point specified by the argument. | |
| GaussianDistribution< VectorType > & | operator= (const GaussianDistribution< VectorType > &source) |
| The assignment operator deep copies its argument. | |
WARNING: This class is not well used or tested. Caveat Emptor!
You can build a GaussianDistribution instance from a bunch of sample points, and have it estimate the statistics, or you can specify the statistics as constructor arguments. Template argument VectorType is a type which supports the following basic vector operations:
Default constructor VectorType() initializes to zero size;
Single argument constructor VectorType(size_t) creates a vector with the number of elements specified by the argument;
Method operator[size_t] returns a reference to the specified element, or a copy/const_reference if the VectorType instant is const;
Method size() returns the number of elements in the vector.
Definition at line 48 of file gaussianDistribution.h.
| typedef VectorType dlr::GaussianDistribution< VectorType >::vector_type |
This public typedef indicates the vector type for the probability distributions.
Examples are Array1D<double>, std::vector<float>, etc.
Definition at line 57 of file gaussianDistribution.h.
| dlr::GaussianDistribution< VectorType >::GaussianDistribution | ( | ) | [inline] |
Default constructor creates an uninitialized distribution.
Definition at line 270 of file gaussianDistribution.h.
| dlr::GaussianDistribution< VectorType >::GaussianDistribution | ( | const Array1D< double > & | mean, | |
| const Array2D< double > & | covariance | |||
| ) | [inline] |
This constructor explicitly sets the mean, and covariance.
| mean | This argument specifies the mean of the distribution. | |
| covariance | This argument specifies the covariance matrix of the distribution. |
Definition at line 285 of file gaussianDistribution.h.
| dlr::GaussianDistribution< VectorType >::GaussianDistribution | ( | const GaussianDistribution< VectorType > & | source | ) | [inline] |
The copy constructor does a deep copy.
| source | The GaussianDistribution instance to be copied. |
Definition at line 301 of file gaussianDistribution.h.
| dlr::GaussianDistribution< VectorType >::~GaussianDistribution | ( | ) | [inline] |
The destructor destroys the GaussianDistribution instance and cleans up any allocated storage.
Definition at line 318 of file gaussianDistribution.h.
| void dlr::GaussianDistribution< VectorType >::addSample | ( | const VectorType & | point | ) | [inline] |
This method adds a sample to the internal list of points from which to compute the distribution statistics.
It is an error to call this method if the mean and covariance have been explicitly set using constructor arguments.
| point | This argument is the point to be added to the sample list. |
Definition at line 328 of file gaussianDistribution.h.
References DLR_THROW3.
| size_t dlr::GaussianDistribution< VectorType >::getCardinality | ( | ) | const [inline] |
This member function returns the number of samples from which the current statistics are being estimated.
It is meaningful only if the statistics are being estimated from sample data (and not if the statistics are explicitly set using constructor arguments).
Definition at line 116 of file gaussianDistribution.h.
| const Array2D< double > & dlr::GaussianDistribution< VectorType >::getCovariance | ( | ) | const [inline] |
This member function returns the covariance matrix of the distribution.
If the covariance was not set using constructor arguments, it is computed from any provided sample points.
Definition at line 370 of file gaussianDistribution.h.
| const Array1D< double > & dlr::GaussianDistribution< VectorType >::getMean | ( | ) | const [inline] |
This member function returns the mean of the distribution.
If the mean was not set using constructor arguments, it is computed from any provided sample points.
Definition at line 383 of file gaussianDistribution.h.
| void dlr::GaussianDistribution< VectorType >::setSampleData | ( | const std::vector< VectorType > & | sampleData | ) | [inline] |
This member function replaces the internal list of points from which to compute the distribution statistics.
Note that you can clear the internal list of samples by calling this member function with an empty vector as its argument. After calling this function, additional sample points can be added by using the member function addSample(const VectorType&). It is an error to call this member function if the mean and covariance have been explicitly set using constructor arguments.
| sampleData | This argument contains the list of points from which to compute the distribution statistics. |
Definition at line 397 of file gaussianDistribution.h.
References DLR_THROW3.
| double dlr::GaussianDistribution< VectorType >::operator() | ( | const VectorType & | x | ) | const [inline] |
This member function returns the value of the Gaussian distribution evaluated at the point specified by the argument.
That is, this member function returns the following value:
p = ((1.0 / sqrt((2 * pi)^N * determinant(C))) * exp[((x - u)^T)(C^(-1))(x - u)])
where N is the dimensionality of the space (the number of elements in vector x), C is the covariance of the distribution, u is the mean of the distribution, and "^" indicates superscript.
| x | This argument is the point at which to evaluate the Gaussian. |
Definition at line 441 of file gaussianDistribution.h.
References DLR_THROW3, dlr::numeric::dot(), and dlr::numeric::matrixMultiply().
| GaussianDistribution< VectorType > & dlr::GaussianDistribution< VectorType >::operator= | ( | const GaussianDistribution< VectorType > & | source | ) | [inline] |
The assignment operator deep copies its argument.
| source | This is the GaussianDistribution instance to be copied. |
Definition at line 477 of file gaussianDistribution.h.
References dlr::GaussianDistribution< VectorType >::m_covariance, dlr::GaussianDistribution< VectorType >::m_inverseCovariance, dlr::GaussianDistribution< VectorType >::m_mean, dlr::GaussianDistribution< VectorType >::m_mutable, dlr::GaussianDistribution< VectorType >::m_needsUpdate, dlr::GaussianDistribution< VectorType >::m_sampleData, and dlr::GaussianDistribution< VectorType >::m_scalingConstant.
1.5.2