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

A Gaussian with (hyper-)spherical covariance. More...

#include <vpdl_gaussian_sphere.h>

Inheritance diagram for vpdl_gaussian_sphere< 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 T 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_sphere (unsigned int var_dim=n)
 Constructor. More...
 
 vpdl_gaussian_sphere (const vector &mean_val, const covar_type &var)
 Constructor - from mean and variance. More...
 
virtual ~vpdl_gaussian_sphere ()
 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...
 
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...
 
box_prob (const vector &min_pt, const vector &max_pt) const
 The probability of being in an axis-aligned box. 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...
 
const covar_typecovariance () const
 Access the scalar variance. More...
 
void set_covariance (const covar_type &var)
 Set the scalar variance. More...
 
virtual void compute_covar (matrix &covar) const
 Compute the covariance of the distribution. More...
 
virtual vector inverse_cdf (const T &p) const
 Compute the inverse of the cumulative_prob() function. More...
 

Protected Attributes

vpdt_gaussian< vector, covar_typeimpl_
 the Gaussian implementation from vpdt. More...
 

Detailed Description

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

A Gaussian with (hyper-)spherical covariance.

Definition at line 29 of file vpdl_gaussian_sphere.h.

Member Typedef Documentation

◆ covar_type

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

the type used internally for covariance.

Definition at line 37 of file vpdl_gaussian_sphere.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_sphere< T, n >::matrix

the data type used for matrices.

Definition at line 35 of file vpdl_gaussian_sphere.h.

◆ vector

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

the data type used for vectors.

Definition at line 33 of file vpdl_gaussian_sphere.h.

Constructor & Destructor Documentation

◆ vpdl_gaussian_sphere() [1/2]

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

Constructor.

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

Definition at line 42 of file vpdl_gaussian_sphere.h.

◆ vpdl_gaussian_sphere() [2/2]

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

Constructor - from mean and variance.

Definition at line 46 of file vpdl_gaussian_sphere.h.

◆ ~vpdl_gaussian_sphere()

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

Destructor.

Definition at line 50 of file vpdl_gaussian_sphere.h.

Member Function Documentation

◆ box_prob()

template<class T , unsigned int n = 0>
T vpdl_gaussian_sphere< T, n >::box_prob ( const vector min_pt,
const vector max_pt 
) const
inlinevirtual

The probability of being in an axis-aligned box.

The box is defined by two points, the minimum and maximum. Reimplemented for efficiency since the axis are independent

Reimplemented from vpdl_distribution< T, n >.

Definition at line 114 of file vpdl_gaussian_sphere.h.

◆ clone()

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

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

Implements vpdl_distribution< T, n >.

Definition at line 53 of file vpdl_gaussian_sphere.h.

◆ compute_covar()

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

Compute the covariance of the distribution.

Should be the identity matrix times var_

Implements vpdl_distribution< T, n >.

Definition at line 147 of file vpdl_gaussian_sphere.h.

◆ compute_mean()

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

Compute the mean of the distribution.

Implements vpdl_distribution< T, n >.

Definition at line 137 of file vpdl_gaussian_sphere.h.

◆ covariance()

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

Access the scalar variance.

Definition at line 140 of file vpdl_gaussian_sphere.h.

◆ cumulative_prob()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian_sphere< 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 106 of file vpdl_gaussian_sphere.h.

◆ density()

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

Evaluate the unnormalized density at a point.

Implements vpdl_distribution< T, n >.

Definition at line 62 of file vpdl_gaussian_sphere.h.

◆ dimension()

template<class T , unsigned int n = 0>
virtual unsigned int vpdl_gaussian_sphere< 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 59 of file vpdl_gaussian_sphere.h.

◆ gradient_density()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian_sphere< 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 83 of file vpdl_gaussian_sphere.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_sphere< 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 74 of file vpdl_gaussian_sphere.h.

◆ mean()

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

Access the mean directly.

Implements vpdl_gaussian_base< T, n >.

Definition at line 131 of file vpdl_gaussian_sphere.h.

◆ norm_const()

template<class T , unsigned int n = 0>
T vpdl_gaussian_sphere< 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 91 of file vpdl_gaussian_sphere.h.

◆ prob_density()

template<class T , unsigned int n = 0>
virtual T vpdl_gaussian_sphere< 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 68 of file vpdl_gaussian_sphere.h.

◆ set_covariance()

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

Set the scalar variance.

Definition at line 143 of file vpdl_gaussian_sphere.h.

◆ set_mean()

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

Set the mean.

Implements vpdl_gaussian_base< T, n >.

Definition at line 134 of file vpdl_gaussian_sphere.h.

◆ sqr_mahal_dist()

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

The squared Mahalanobis distance to this point.

Non-virtual for efficiency

Definition at line 98 of file vpdl_gaussian_sphere.h.

Member Data Documentation

◆ impl_

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

the Gaussian implementation from vpdt.

Definition at line 154 of file vpdl_gaussian_sphere.h.


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