2 #ifndef vpdl_gaussian_h_ 3 #define vpdl_gaussian_h_ 21 # include <vcl_msvc_warnings.h> 25 template<
class T,
unsigned int n=0>
44 :
impl_(mean_val,covar) {}
61 return impl_.density(pt);
82 return impl_.gradient_density(pt,g);
90 return impl_.norm_const();
97 return impl_.sqr_mahal_dist(pt);
105 return impl_.cumulative_prob(pt);
121 impl_.compute_covar(M);
128 impl_.covar.set_matrix(covar);
134 impl_.compute_covar(covar);
154 #endif // vpdl_gaussian_h_ vpdt_field_traits< field_type >::matrix_type matrix
the data type used for matrices.
vpdt_field_default< T, n >::type vector
the data type used for vectors.
virtual void compute_mean(vector &mean_val) const
Compute the mean of the distribution.
virtual T gradient_density(const vector &pt, vector &g) const
Compute the gradient of the unnormalized density at a point.
virtual void set_mean(const vector &mean_val)
Set the mean.
virtual T density(const vector &pt) const
Evaluate the unnormalized density at a point.
T sqr_mahal_dist(const vector &pt) const
The squared Mahalanobis distance to this point.
matrix covar_type
the type used internally for covariance.
The basic functions for probability calculations.
virtual void compute_covar(matrix &covar) const
Compute the covariance of the distribution.
void set_covariance(const covar_type &covar)
Set the covariance matrix.
vpdl_gaussian(unsigned int var_dim=n)
Constructor.
virtual vpdl_distribution< T, n > * clone() const
Create a copy on the heap and return base class pointer.
virtual T norm_const() const
The normalization constant for the density.
The abstract base class for Gaussian distributions.
const matrix & covar_eigenvecs() const
Access the eigenvectors of the covariance matrix.
T vpdt_log_prob_density(const vpdl_distribution< T, n > &d, const typename vpdt_field_default< T, n >::type &pt)
The log probability density wrapper for vpdt.
virtual ~vpdl_gaussian()
Destructor.
vpdt_field_traits< vector >::matrix_type matrix
the data type used for matrices.
A Gaussian with variance independent in each dimension.
vpdl_gaussian(const vector &mean_val, const covar_type &covar)
Constructor - from mean and variance.
The abstract base class for Gaussian distributions.
A generic Gaussian distribution.
T vpdt_prob_density(const vpdl_distribution< T, n > &d, const typename vpdt_field_default< T, n >::type &pt)
probability density wrapper for vpdt.
void set_covar_eigenvecs(const matrix &m)
Set the eigenvectors of the covariance matrix.
virtual unsigned int dimension() const
Return the run time dimension, which does not equal n when n==0.
The field traits class (scalar).
The base class for all probability distributions.
vpdt_gaussian< vector > impl_
the Gaussian implementation from vpdt.
virtual T log_prob_density(const vector &pt) const
Evaluate the log probability density at a point.
virtual T cumulative_prob(const vector &pt) const
Evaluate the cumulative distribution function at a point.
virtual T prob_density(const vector &pt) const
Evaluate the probability density at a point.
A Gaussian with variance independent in each dimension.
The basic functions for log of probability calculation.
void set_covar_eigenvals(const vector &v)
Set the eigenvalues of the covariance matrix.
const vector & covar_eigenvals() const
Access the eigenvalues of the covariance matrix.
virtual const vector & mean() const
Access the mean directly.
covar_type covariance() const
Access the covariance - requires computation.