Public Types | Public Member Functions | Static Public Attributes | Private Attributes
vpdl_mixture_of< dist_t > Class Template Reference

A mixture of a fixed type of distributions. More...

#include <vpdl_mixture_of.h>

Inheritance diagram for vpdl_mixture_of< dist_t >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef dist_t::field_type field_type
 the data type to represent a point in the field.
typedef dist_t component_type
 define the component type.
typedef dist_t::field_type F
 the data type to represent a point in the field.
typedef vpdt_field_traits
< field_type >::scalar_type 
T
 define the scalar type (normally specified by template parameter T).
typedef vpdt_field_traits
< field_type >::vector_type 
vector
 define the vector type.
typedef vpdt_field_traits
< field_type >::matrix_type 
matrix
 the data type used for matrices.

Public Member Functions

 vpdl_mixture_of ()
virtual ~vpdl_mixture_of ()
virtual vpdl_distribution< T, n > * clone () const
 Create a copy on the heap and return base class pointer.
virtual unsigned int dimension () const
 Return the run time dimension.
unsigned int num_components () const
 Return the number of components in the mixture.
const dist_t & distribution (unsigned int index) const
 Access (const) a component distribution of the mixture.
dist_t & distribution (unsigned int index)
 Access a component distribution of the mixture.
T weight (unsigned int index) const
 Return the weight of a component in the mixture.
void set_weight (unsigned int index, const T &w)
 Set the weight of a component in the mixture.
bool insert (const dist_t &d, const T &wght=T(0))
 Insert a new component at the end of the vector.
bool remove_last ()
 Remove the last component in the vector.
T density (const vector &pt) const
 Compute the unnormalized density at this point.
T prob_density (const vector &pt) const
 Compute the probability density at this point.
virtual T gradient_density (const vector &pt, vector &g) const
 Compute the gradient of the unnormalized density at a point.
T box_prob (const vector &min_pt, const vector &max_pt) const
 The probability integrated over a box.
virtual T cumulative_prob (const vector &pt) const
 Evaluate the cumulative distribution function at a point.
virtual void compute_mean (vector &mean) const
 Compute the mean of the distribution.
virtual void compute_covar (matrix &covar) const
 Compute the covariance of the distribution.
virtual T norm_const () const
 The normalization constant for the density.
void normalize_weights ()
 Normalize the weights of the components to add to 1.
void sort ()
 Sort the components in order of decreasing weight.
void sort (unsigned int idx1, unsigned int idx2)
 Sort the components in the range idx1 to idx2 in order of decreasing weight.
template<class comp_type_ >
void sort (comp_type_ comp)
 Sort the components using any StrictWeakOrdering function.
template<class comp_type_ >
void sort (comp_type_ comp, unsigned int idx1, unsigned int idx2)
 Sort the components in the range idx1 to idx2 using any StrictWeakOrdering function.
virtual T log_prob_density (const vector &pt) const
 Evaluate the log probability density at a point.
virtual vector inverse_cdf (const T &p) const
 Compute the inverse of the cumulative_prob() function.

Static Public Attributes

static const unsigned int n = vpdt_field_traits<field_type>::dimension
 define the fixed dimension (normally specified by template parameter n).

Private Attributes

vpdt_mixture_of< dist_t > impl_

Detailed Description

template<class dist_t>
class vpdl_mixture_of< dist_t >

A mixture of a fixed type of distributions.

A mixture is a weighted linear combination of other mixtures. This class represents a mixture of a specific type of distribution. Each component in the mixture has its own weight and parameters, but each must be of the same type.

Template Parameters:
dist_tis the type of a component distribution
See also:
vpdl_mixture

Definition at line 29 of file vpdl_mixture_of.h.


Member Typedef Documentation

template<class dist_t>
typedef dist_t vpdl_mixture_of< dist_t >::component_type

define the component type.

Definition at line 39 of file vpdl_mixture_of.h.

template<class dist_t>
typedef dist_t::field_type vpdl_mixture_of< dist_t >::F

the data type to represent a point in the field.

Definition at line 44 of file vpdl_mixture_of.h.

template<class dist_t>
typedef dist_t::field_type vpdl_mixture_of< dist_t >::field_type

the data type to represent a point in the field.

Reimplemented from vpdl_distribution< T, n >.

Definition at line 37 of file vpdl_mixture_of.h.

template<class dist_t>
typedef vpdt_field_traits<field_type>::matrix_type vpdl_mixture_of< dist_t >::matrix

the data type used for matrices.

Reimplemented from vpdl_multi_cmp_dist< vpdt_dist_traits< dist_t >::scalar_type, vpdt_dist_traits< dist_t >::dimension >.

Definition at line 50 of file vpdl_mixture_of.h.

template<class dist_t>
typedef vpdt_field_traits<field_type>::scalar_type vpdl_mixture_of< dist_t >::T

define the scalar type (normally specified by template parameter T).

Definition at line 46 of file vpdl_mixture_of.h.

template<class dist_t>
typedef vpdt_field_traits<field_type>::vector_type vpdl_mixture_of< dist_t >::vector

Constructor & Destructor Documentation

template<class dist_t>
vpdl_mixture_of< dist_t >::vpdl_mixture_of ( ) [inline]

Definition at line 53 of file vpdl_mixture_of.h.

template<class dist_t>
virtual vpdl_mixture_of< dist_t >::~vpdl_mixture_of ( ) [inline, virtual]

Definition at line 56 of file vpdl_mixture_of.h.


Member Function Documentation

template<class dist_t>
T vpdl_mixture_of< dist_t >::box_prob ( const vector min_pt,
const vector max_pt 
) const [inline, virtual]

The probability integrated over a box.

Reimplemented from vpdl_distribution< T, n >.

Definition at line 106 of file vpdl_mixture_of.h.

template<class dist_t>
virtual vpdl_distribution<T,n>* vpdl_mixture_of< dist_t >::clone ( ) const [inline, virtual]

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

Implements vpdl_distribution< T, n >.

Definition at line 59 of file vpdl_mixture_of.h.

template<class dist_t>
virtual void vpdl_mixture_of< dist_t >::compute_covar ( matrix covar) const [inline, virtual]

Compute the covariance of the distribution.

Implements vpdl_distribution< T, n >.

Definition at line 120 of file vpdl_mixture_of.h.

template<class dist_t>
virtual void vpdl_mixture_of< dist_t >::compute_mean ( vector mean) const [inline, virtual]

Compute the mean of the distribution.

weighted average of the component means

Implements vpdl_distribution< T, n >.

Definition at line 117 of file vpdl_mixture_of.h.

template<class dist_t>
virtual T vpdl_mixture_of< dist_t >::cumulative_prob ( const vector pt) const [inline, virtual]

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 112 of file vpdl_mixture_of.h.

template<class dist_t>
T vpdl_mixture_of< dist_t >::density ( const vector pt) const [inline, virtual]

Compute the unnormalized density at this point.

Implements vpdl_distribution< T, n >.

Definition at line 91 of file vpdl_mixture_of.h.

template<class dist_t>
virtual unsigned int vpdl_mixture_of< dist_t >::dimension ( ) const [inline, virtual]

Return the run time dimension.

Implements vpdl_distribution< T, n >.

Definition at line 65 of file vpdl_mixture_of.h.

template<class dist_t>
const dist_t& vpdl_mixture_of< dist_t >::distribution ( unsigned int  index) const [inline]

Access (const) a component distribution of the mixture.

Definition at line 71 of file vpdl_mixture_of.h.

template<class dist_t>
dist_t& vpdl_mixture_of< dist_t >::distribution ( unsigned int  index) [inline]

Access a component distribution of the mixture.

Definition at line 75 of file vpdl_mixture_of.h.

template<class dist_t>
virtual T vpdl_mixture_of< dist_t >::gradient_density ( const vector pt,
vector g 
) const [inline, virtual]

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 100 of file vpdl_mixture_of.h.

template<class dist_t>
bool vpdl_mixture_of< dist_t >::insert ( const dist_t &  d,
const T wght = T(0) 
) [inline]

Insert a new component at the end of the vector.

Definition at line 84 of file vpdl_mixture_of.h.

template<class T, unsigned int n>
vpdl_distribution< T, n >::vector vpdl_distribution< T, n >::inverse_cdf ( const T &  p) const [virtual, inherited]

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 75 of file vpdl_distribution.txx.

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::log_prob_density ( const vector pt) const [inline, virtual, inherited]

Evaluate the log probability density at a point.

Reimplemented in vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.

Definition at line 62 of file vpdl_distribution.h.

template<class dist_t>
virtual T vpdl_mixture_of< dist_t >::norm_const ( ) const [inline, virtual]

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 125 of file vpdl_mixture_of.h.

template<class dist_t>
void vpdl_mixture_of< dist_t >::normalize_weights ( ) [inline]

Normalize the weights of the components to add to 1.

Definition at line 128 of file vpdl_mixture_of.h.

template<class dist_t>
unsigned int vpdl_mixture_of< dist_t >::num_components ( ) const [inline, virtual]

Return the number of components in the mixture.

Implements vpdl_multi_cmp_dist< vpdt_dist_traits< dist_t >::scalar_type, vpdt_dist_traits< dist_t >::dimension >.

Definition at line 68 of file vpdl_mixture_of.h.

template<class dist_t>
T vpdl_mixture_of< dist_t >::prob_density ( const vector pt) const [inline, virtual]

Compute the probability density at this point.

Reimplemented from vpdl_distribution< T, n >.

Definition at line 94 of file vpdl_mixture_of.h.

template<class dist_t>
bool vpdl_mixture_of< dist_t >::remove_last ( ) [inline]

Remove the last component in the vector.

Definition at line 88 of file vpdl_mixture_of.h.

template<class dist_t>
void vpdl_mixture_of< dist_t >::set_weight ( unsigned int  index,
const T w 
) [inline]

Set the weight of a component in the mixture.

Definition at line 81 of file vpdl_mixture_of.h.

template<class dist_t>
void vpdl_mixture_of< dist_t >::sort ( ) [inline]

Sort the components in order of decreasing weight.

Definition at line 131 of file vpdl_mixture_of.h.

template<class dist_t>
void vpdl_mixture_of< dist_t >::sort ( unsigned int  idx1,
unsigned int  idx2 
) [inline]

Sort the components in the range idx1 to idx2 in order of decreasing weight.

Definition at line 134 of file vpdl_mixture_of.h.

template<class dist_t>
template<class comp_type_ >
void vpdl_mixture_of< dist_t >::sort ( comp_type_  comp) [inline]

Sort the components using any StrictWeakOrdering function.

The prototype should be

 template <class dist_t>
 bool functor(const dist_t& d1, const vpdt_dist_traits<dist_t>::scalar_type& w1,
              const dist_t& d2, const vpdt_dist_traits<dist_t>::scalar_type& w2);

Definition at line 144 of file vpdl_mixture_of.h.

template<class dist_t>
template<class comp_type_ >
void vpdl_mixture_of< dist_t >::sort ( comp_type_  comp,
unsigned int  idx1,
unsigned int  idx2 
) [inline]

Sort the components in the range idx1 to idx2 using any StrictWeakOrdering function.

Definition at line 148 of file vpdl_mixture_of.h.

template<class dist_t>
T vpdl_mixture_of< dist_t >::weight ( unsigned int  index) const [inline]

Return the weight of a component in the mixture.

Definition at line 78 of file vpdl_mixture_of.h.


Member Data Documentation

template<class dist_t>
vpdt_mixture_of<dist_t> vpdl_mixture_of< dist_t >::impl_ [private]

Definition at line 33 of file vpdl_mixture_of.h.

template<class dist_t>
const unsigned int vpdl_mixture_of< dist_t >::n = vpdt_field_traits<field_type>::dimension [static]

define the fixed dimension (normally specified by template parameter n).

Definition at line 42 of file vpdl_mixture_of.h.


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