A mixture of distributions with a fixed size of s components. More...
#include <bsta_mixture_fixed.h>
Classes | |
struct | component |
A struct to hold the component distributions and weights. More... | |
class | sort_adaptor |
This adaptor allows users to define ordering functors on the components without accessing the components directly. More... | |
class | sort_weight |
This functor is used by default for sorting with STL. More... | |
Public Types | |
enum | { max_components = s } |
typedef dist_ | dist_type |
typedef dist_type | component_type |
enum | |
The dimension of the distribution. More... | |
typedef dist_::math_type | math_type |
The type used for calculations. | |
typedef vnl_vector_fixed < math_type, dimension > | vector_type |
The type used for a n-dimensional vector of math types. | |
typedef vector_type | field_type |
for compatibility with vpdl/vpdt. | |
Public Member Functions | |
bsta_mixture_fixed () | |
bsta_mixture_fixed (const bsta_mixture_fixed< dist_, s > &other) | |
~bsta_mixture_fixed () | |
bsta_mixture_fixed< dist_, s > & | operator= (const bsta_mixture_fixed< dist_, s > &rhs) |
Assignment operator. | |
unsigned int | num_components () const |
Return the number of components in the mixture. | |
const dist_ & | distribution (unsigned int index) const |
Access (const) a component distribution of the mixture. | |
dist_ & | 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_ &d, const T &weight=T(0)) |
Insert a new component in the next location in the array. | |
void | remove_last () |
Remove the last component in the vector. | |
T | prob_density (const vector_ &pt) const |
Compute the probability density at this point. | |
T | probability (const vector_ &min_pt, const vector_ &max_pt) const |
The probability integrated over a box. | |
vector_ | expected_value () |
void | normalize_weights () |
Normalize the weights of the components to add to 1. | |
void | sort () |
Sort the components 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 idx) |
Sort the first components up to index idx. | |
vector_ | sample (vnl_random &rng) const |
sample from the mixture. | |
Private Types | |
typedef dist_::math_type | T |
typedef dist_::vector_type | vector_ |
Private Attributes | |
component | components_ [s] |
The fixed size array of components. | |
unsigned | num_components_ |
The number of active components. |
A mixture of distributions with a fixed size of s components.
Definition at line 26 of file bsta_mixture_fixed.h.
typedef dist_type bsta_mixture_fixed< dist_, s >::component_type |
Definition at line 31 of file bsta_mixture_fixed.h.
typedef dist_ bsta_mixture_fixed< dist_, s >::dist_type |
Definition at line 30 of file bsta_mixture_fixed.h.
typedef vector_type bsta_distribution< dist_::math_type , n >::field_type [inherited] |
for compatibility with vpdl/vpdt.
Definition at line 29 of file bsta_distribution.h.
typedef dist_::math_type bsta_distribution< dist_::math_type , n >::math_type [inherited] |
The type used for calculations.
Definition at line 25 of file bsta_distribution.h.
typedef dist_::math_type bsta_mixture_fixed< dist_, s >::T [private] |
Definition at line 35 of file bsta_mixture_fixed.h.
typedef dist_::vector_type bsta_mixture_fixed< dist_, s >::vector_ [private] |
Definition at line 36 of file bsta_mixture_fixed.h.
typedef vnl_vector_fixed<math_type,dimension> bsta_distribution< dist_::math_type , n >::vector_type [inherited] |
The type used for a n-dimensional vector of math types.
Definition at line 27 of file bsta_distribution.h.
anonymous enum [inherited] |
The dimension of the distribution.
Definition at line 23 of file bsta_distribution.h.
anonymous enum |
Definition at line 32 of file bsta_mixture_fixed.h.
bsta_mixture_fixed< dist_, s >::bsta_mixture_fixed | ( | ) | [inline] |
Definition at line 87 of file bsta_mixture_fixed.h.
bsta_mixture_fixed< dist_, s >::bsta_mixture_fixed | ( | const bsta_mixture_fixed< dist_, s > & | other | ) | [inline] |
Definition at line 90 of file bsta_mixture_fixed.h.
bsta_mixture_fixed< dist_, s >::~bsta_mixture_fixed | ( | ) | [inline] |
Definition at line 100 of file bsta_mixture_fixed.h.
const dist_& bsta_mixture_fixed< dist_, s >::distribution | ( | unsigned int | index | ) | const [inline] |
Access (const) a component distribution of the mixture.
Definition at line 121 of file bsta_mixture_fixed.h.
dist_& bsta_mixture_fixed< dist_, s >::distribution | ( | unsigned int | index | ) | [inline] |
Access a component distribution of the mixture.
Definition at line 125 of file bsta_mixture_fixed.h.
vector_ bsta_mixture_fixed< dist_, s >::expected_value | ( | ) | [inline] |
Definition at line 173 of file bsta_mixture_fixed.h.
bool bsta_mixture_fixed< dist_, s >::insert | ( | const dist_ & | d, |
const T & | weight = T(0) |
||
) | [inline] |
Insert a new component in the next location in the array.
Definition at line 135 of file bsta_mixture_fixed.h.
void bsta_mixture_fixed< dist_, s >::normalize_weights | ( | ) | [inline] |
Normalize the weights of the components to add to 1.
Definition at line 183 of file bsta_mixture_fixed.h.
unsigned int bsta_mixture_fixed< dist_, s >::num_components | ( | ) | const [inline] |
Return the number of components in the mixture.
Definition at line 118 of file bsta_mixture_fixed.h.
bsta_mixture_fixed<dist_,s>& bsta_mixture_fixed< dist_, s >::operator= | ( | const bsta_mixture_fixed< dist_, s > & | rhs | ) | [inline] |
Assignment operator.
Definition at line 105 of file bsta_mixture_fixed.h.
T bsta_mixture_fixed< dist_, s >::prob_density | ( | const vector_ & | pt | ) | const [inline] |
Compute the probability density at this point.
Definition at line 149 of file bsta_mixture_fixed.h.
T bsta_mixture_fixed< dist_, s >::probability | ( | const vector_ & | min_pt, |
const vector_ & | max_pt | ||
) | const [inline] |
The probability integrated over a box.
Definition at line 161 of file bsta_mixture_fixed.h.
void bsta_mixture_fixed< dist_, s >::remove_last | ( | ) | [inline] |
Remove the last component in the vector.
Definition at line 145 of file bsta_mixture_fixed.h.
vector_ bsta_mixture_fixed< dist_, s >::sample | ( | vnl_random & | rng | ) | const [inline] |
sample from the mixture.
randomly selects a component wrt normalized component weights, then for now returns the mean of the selected component
first normalize the weights (this is const methods so we cannot call the class-method normalize_weights().
Definition at line 216 of file bsta_mixture_fixed.h.
void bsta_mixture_fixed< dist_, s >::set_weight | ( | unsigned int | index, |
const T & | w | ||
) | [inline] |
Set the weight of a component in the mixture.
Definition at line 132 of file bsta_mixture_fixed.h.
void bsta_mixture_fixed< dist_, s >::sort | ( | ) | [inline] |
Sort the components in order of decreasing weight.
Definition at line 194 of file bsta_mixture_fixed.h.
void bsta_mixture_fixed< dist_, s >::sort | ( | comp_type_ | comp | ) | [inline] |
Sort the components using any StrictWeakOrdering function.
The prototype should be
template <class T> bool functor(const bsta_distribution<T>& d1, const T& w1, const bsta_distribution<T>& d2, const T& w2);
Definition at line 204 of file bsta_mixture_fixed.h.
void bsta_mixture_fixed< dist_, s >::sort | ( | comp_type_ | comp, |
unsigned int | idx | ||
) | [inline] |
Sort the first components up to index idx.
Definition at line 209 of file bsta_mixture_fixed.h.
T bsta_mixture_fixed< dist_, s >::weight | ( | unsigned int | index | ) | const [inline] |
Return the weight of a component in the mixture.
Definition at line 129 of file bsta_mixture_fixed.h.
component bsta_mixture_fixed< dist_, s >::components_[s] [private] |
The fixed size array of components.
Definition at line 81 of file bsta_mixture_fixed.h.
unsigned bsta_mixture_fixed< dist_, s >::num_components_ [private] |
The number of active components.
Definition at line 83 of file bsta_mixture_fixed.h.