Public Types | Public Member Functions | Protected Attributes | List of all members
vpdl_gaussian< T, n > Class Template Reference

A Gaussian with variance independent in each dimension. More...

#include <vpdl_gaussian.h>

Inheritance diagram for vpdl_gaussian< T, n >:
Inheritance graph
[legend]

Public Types

typedef vpdt_field_default< T, n >::type vector
 the data type used for vectors. More...
 
typedef vpdt_field_traits< vector >::matrix_type matrix
 the data type used for matrices. More...
 
typedef matrix covar_type
 the type used internally for covariance. More...
 
typedef vpdt_field_default< T, n >::type field_type
 the data type used for vectors. More...
 

Public Member Functions

 vpdl_gaussian (unsigned int var_dim=n)
 Constructor. More...
 
 vpdl_gaussian (const vector &mean_val, const covar_type &covar)
 Constructor - from mean and variance. More...
 
virtual ~vpdl_gaussian ()
 Destructor. More...
 
virtual vpdl_distribution< T, n > * clone () const
 Create a copy on the heap and return base class pointer. More...
 
virtual unsigned int dimension () const
 Return the run time dimension, which does not equal n when n==0. More...
 
virtual T density (const vector &pt) const
 Evaluate the unnormalized density at a point. More...
 
virtual T prob_density (const vector &pt) const
 Evaluate the probability density at a point. More...
 
virtual T log_prob_density (const vector &pt) const
 Evaluate the log probability density at a point. More...
 
virtual T gradient_density (const vector &pt, vector &g) const
 Compute the gradient of the unnormalized density at a point. More...
 
virtual T norm_const () const
 The normalization constant for the density. More...
 
sqr_mahal_dist (const vector &pt) const
 The squared Mahalanobis distance to this point. More...
 
virtual T cumulative_prob (const vector &pt) const
 Evaluate the cumulative distribution function at a point. More...
 
virtual const vectormean () const
 Access the mean directly. More...
 
virtual void set_mean (const vector &mean_val)
 Set the mean. More...
 
virtual void compute_mean (vector &mean_val) const
 Compute the mean of the distribution. More...
 
covar_type covariance () const
 Access the covariance - requires computation. More...
 
void set_covariance (const covar_type &covar)
 Set the covariance matrix. More...
 
virtual void compute_covar (matrix &covar) const
 Compute the covariance of the distribution. More...
 
const matrixcovar_eigenvecs () const
 Access the eigenvectors of the covariance matrix. More...
 
const vectorcovar_eigenvals () const
 Access the eigenvalues of the covariance matrix. More...
 
void set_covar_eigenvecs (const matrix &m)
 Set the eigenvectors of the covariance matrix. More...
 
void set_covar_eigenvals (const vector &v)
 Set the eigenvalues of the covariance matrix. More...
 
virtual vector inverse_cdf (const T &p) const
 Compute the inverse of the cumulative_prob() function. More...
 
virtual T box_prob (const vector &min_pt, const vector &max_pt) const
 The probability of being in an axis-aligned box. More...
 

Protected Attributes

vpdt_gaussian< vectorimpl_
 the Gaussian implementation from vpdt. More...
 

Detailed Description

template<class T, unsigned int n = 0>
class vpdl_gaussian< T, n >

A Gaussian with variance independent in each dimension.

Definition at line 26 of file vpdl_gaussian.h.

Member Typedef Documentation

◆ covar_type

template<class T , unsigned int n = 0>
typedef matrix vpdl_gaussian< T, n >::covar_type

the type used internally for covariance.

Definition at line 34 of file vpdl_gaussian.h.

◆ field_type

template<class T, unsigned int n = 0>
typedef vpdt_field_default<T,n>::type vpdl_distribution< T, n >::field_type
inherited

the data type used for vectors.

Definition at line 39 of file vpdl_distribution.h.

◆ matrix

template<class T , unsigned int n = 0>
typedef vpdt_field_traits<vector>::matrix_type vpdl_gaussian< T, n >::matrix

the data type used for matrices.

Definition at line 32 of file vpdl_gaussian.h.

◆ vector

template<class T , unsigned int n = 0>
typedef vpdt_field_default<T,n>::type vpdl_gaussian< T, n >::vector

the data type used for vectors.

Definition at line 30 of file vpdl_gaussian.h.

Constructor & Destructor Documentation

◆ vpdl_gaussian() [1/2]

template<class T , unsigned int n = 0>
vpdl_gaussian< T, n >::vpdl_gaussian ( unsigned int  var_dim = n)
inline

Constructor.

Optionally initialize the dimension for when n==0. Otherwise var_dim is ignored

Definition at line 39 of file vpdl_gaussian.h.

◆ vpdl_gaussian() [2/2]

template<class T , unsigned int n = 0>
vpdl_gaussian< T, n >::vpdl_gaussian ( const vector mean_val,
const covar_type covar 
)
inline

Constructor - from mean and variance.

Definition at line 43 of file vpdl_gaussian.h.

◆ ~vpdl_gaussian()

template<class T , unsigned int n = 0>
virtual vpdl_gaussian< T, n >::~vpdl_gaussian ( )
inlinevirtual

Destructor.

Definition at line 47 of file vpdl_gaussian.h.

Member Function Documentation

◆ box_prob()

template<class T , unsigned int n>
T vpdl_distribution< T, n >::box_prob ( const vector min_pt,
const vector max_pt 
) const
virtualinherited

The probability of being in an axis-aligned box.

The box is defined by two points, the minimum and maximum. Implemented in terms of cumulative_prob() by default.

Reimplemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, and vpdl_gaussian_sphere< T, n >.

Definition at line 89 of file vpdl_distribution.hxx.

◆ clone()

template<class T , unsigned int n = 0>
virtual vpdl_distribution<T,n>* vpdl_gaussian< T, n >::clone ( ) const
inlinevirtual

Create a copy on the heap and return base class pointer.

Implements vpdl_distribution< T, n >.

Definition at line 50 of file vpdl_gaussian.h.

◆ compute_covar()

template<class T , unsigned int n = 0>
virtual void vpdl_gaussian< T, n >::compute_covar ( matrix covar) const
inlinevirtual

Compute the covariance of the distribution.

Implements vpdl_distribution< T, n >.

Definition at line 132 of file vpdl_gaussian.h.

◆ compute_mean()

template<class T , unsigned int n = 0>
virtual void vpdl_gaussian< T, n >::compute_mean ( vector mean_val) const
inlinevirtual

Compute the mean of the distribution.

Implements vpdl_distribution< T, n >.

Definition at line 115 of file vpdl_gaussian.h.

◆ covar_eigenvals()

template<class T , unsigned int n = 0>
const vector& vpdl_gaussian< T, n >::covar_eigenvals ( ) const
inline

Access the eigenvalues of the covariance matrix.

Definition at line 141 of file vpdl_gaussian.h.

◆ covar_eigenvecs()

template<class T , unsigned int n = 0>
const matrix& vpdl_gaussian< T, n >::covar_eigenvecs ( ) const
inline

Access the eigenvectors of the covariance matrix.

Definition at line 138 of file vpdl_gaussian.h.

◆ covariance()

template<class T , unsigned int n = 0>
covar_type vpdl_gaussian< T, n >::covariance ( ) const
inline

Access the covariance - requires computation.

Definition at line 118 of file vpdl_gaussian.h.

◆ cumulative_prob()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian< T, n >::cumulative_prob ( const vector pt) const
inlinevirtual

Evaluate the cumulative distribution function at a point.

This is the integral of the density function from negative infinity (in all dimensions) to the point in question

Implements vpdl_distribution< T, n >.

Definition at line 103 of file vpdl_gaussian.h.

◆ density()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian< T, n >::density ( const vector pt) const
inlinevirtual

Evaluate the unnormalized density at a point.

Implements vpdl_distribution< T, n >.

Definition at line 59 of file vpdl_gaussian.h.

◆ dimension()

template<class T , unsigned int n = 0>
virtual unsigned int vpdl_gaussian< T, n >::dimension ( ) const
inlinevirtual

Return the run time dimension, which does not equal n when n==0.

Implements vpdl_distribution< T, n >.

Definition at line 56 of file vpdl_gaussian.h.

◆ gradient_density()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian< T, n >::gradient_density ( const vector pt,
vector g 
) const
inlinevirtual

Compute the gradient of the unnormalized density at a point.

Returns
the density at pt since it is usually needed as well, and is often trivial to compute while computing gradient
Return values
gthe gradient vector

Implements vpdl_distribution< T, n >.

Definition at line 80 of file vpdl_gaussian.h.

◆ inverse_cdf()

template<class T, unsigned int n>
vpdl_distribution< T, n >::vector vpdl_distribution< T, n >::inverse_cdf ( const T &  p) const
virtualinherited

Compute the inverse of the cumulative_prob() function.

The value of x: P(x'<x) = P for x' drawn from the distribution.

Note
This is only valid for univariate distributions multivariate distributions will return a quiet NaN

The value of x: P(x'<x) = P for x' drawn from the distribution. This is only valid for univariate distributions multivariate distributions will return -infinity

Definition at line 78 of file vpdl_distribution.hxx.

◆ log_prob_density()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian< T, n >::log_prob_density ( const vector pt) const
inlinevirtual

Evaluate the log probability density at a point.

Reimplemented from vpdl_distribution< T, n >.

Definition at line 71 of file vpdl_gaussian.h.

◆ mean()

template<class T , unsigned int n = 0>
virtual const vector& vpdl_gaussian< T, n >::mean ( ) const
inlinevirtual

Access the mean directly.

Implements vpdl_gaussian_base< T, n >.

Definition at line 109 of file vpdl_gaussian.h.

◆ norm_const()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian< T, n >::norm_const ( ) const
inlinevirtual

The normalization constant for the density.

When density() is multiplied by this value it becomes prob_density norm_const() is reciprocal of the integral of density over the entire field

Implements vpdl_distribution< T, n >.

Definition at line 88 of file vpdl_gaussian.h.

◆ prob_density()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian< T, n >::prob_density ( const vector pt) const
inlinevirtual

Evaluate the probability density at a point.

Reimplemented from vpdl_distribution< T, n >.

Definition at line 65 of file vpdl_gaussian.h.

◆ set_covar_eigenvals()

template<class T , unsigned int n = 0>
void vpdl_gaussian< T, n >::set_covar_eigenvals ( const vector v)
inline

Set the eigenvalues of the covariance matrix.

Definition at line 147 of file vpdl_gaussian.h.

◆ set_covar_eigenvecs()

template<class T , unsigned int n = 0>
void vpdl_gaussian< T, n >::set_covar_eigenvecs ( const matrix m)
inline

Set the eigenvectors of the covariance matrix.

Definition at line 144 of file vpdl_gaussian.h.

◆ set_covariance()

template<class T , unsigned int n = 0>
void vpdl_gaussian< T, n >::set_covariance ( const covar_type covar)
inline

Set the covariance matrix.

Definition at line 126 of file vpdl_gaussian.h.

◆ set_mean()

template<class T , unsigned int n = 0>
virtual void vpdl_gaussian< T, n >::set_mean ( const vector mean_val)
inlinevirtual

Set the mean.

Implements vpdl_gaussian_base< T, n >.

Definition at line 112 of file vpdl_gaussian.h.

◆ sqr_mahal_dist()

template<class T , unsigned int n = 0>
T vpdl_gaussian< T, n >::sqr_mahal_dist ( const vector pt) const
inline

The squared Mahalanobis distance to this point.

Non-virtual for efficiency

Definition at line 95 of file vpdl_gaussian.h.

Member Data Documentation

◆ impl_

template<class T , unsigned int n = 0>
vpdt_gaussian<vector> vpdl_gaussian< T, n >::impl_
protected

the Gaussian implementation from vpdt.

Definition at line 151 of file vpdl_gaussian.h.


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