2 #ifndef vpdt_mixture_detector_h_ 3 #define vpdt_mixture_detector_h_ 19 template <
class mixture_type,
class detector_type>
31 typedef typename mixture_type::field_type
F;
39 bool operator() (
const mixture_type& mix,
const F& sample,
bool& result)
const 42 for (
unsigned int i=0; i<mix.num_components(); ++i){
43 if ( !
detect(mix.distribution(i),sample,result) )
58 template <
class mixture_type,
class detector_type>
70 typedef typename mixture_type::field_type
F;
78 bool operator() (
const mixture_type& mix,
const F& sample,
bool& result)
const 81 for (
unsigned int i=0; i<mix.num_components(); ++i){
82 if ( !
detect(mix.distribution(i),sample,result) )
97 template <
class mixture_type,
class detector_type>
109 typedef typename mixture_type::field_type
F;
118 bool operator() (
const mixture_type& mix,
const F& sample,
bool& result)
const 120 T total_weight =
T(0);
122 for (
unsigned int i=0; i<mix.num_components(); ++i){
125 if ( !
detect(mix.distribution(i),sample,result) )
129 total_weight += mix.weight(i);
141 #endif // vpdt_mixture_detector_h_ bool operator()(const mixture_type &mix, const F &sample, bool &result) const
The main function.
static const unsigned int return_dim
the functor return type.
Apply a detector to each component in order while the total weight is below a threshold.
detector_type detect
The detector to apply to components.
bool return_type
the functor return type.
vpdt_mixture_top_weight_detector(const detector_type &d, const T &w=T(0.5))
Constructor.
vpdt_mixture_all_detector(const detector_type &d)
Constructor.
T weight_thresh
The total weight threshold.
mixture_type distribution_type
the distribution operated on by the detector.
vpdt_field_traits< F >::scalar_type T
define the scalar type (normally specified by template parameter T).
bool return_type
the functor return type.
vpdt_field_traits< F >::scalar_type T
define the scalar type (normally specified by template parameter T).
Apply a detector to each component to see if ANY match.
mixture_type distribution_type
the distribution operated on by the detector.
static const unsigned int return_dim
the functor return type.
mixture_type::field_type F
the data type to represent a point in the field.
Apply a detector to each component to see if ALL match.
mixture_type::field_type F
the data type to represent a point in the field.
bool operator()(const mixture_type &mix, const F &sample, bool &result) const
The main function.
specialized template trait classes for properties of a field type
detector_type detect
The detector to apply to components.
detector_type detect
The detector to apply to components.
mixture_type distribution_type
the distribution operated on by the detector.
The field traits class (scalar).
vpdt_field_traits< F >::scalar_type T
define the scalar type (normally specified by template parameter T).
bool return_type
the functor return type.
static const unsigned int return_dim
the functor return type.
vpdt_mixture_any_detector(const detector_type &d)
Constructor.
mixture_type::field_type F
the data type to represent a point in the field.
bool operator()(const mixture_type &mix, const F &sample, bool &result) const
The main function.