2 #ifndef vpdt_mixture_accessors_h_ 3 #define vpdt_mixture_accessors_h_ 21 template <
class mixture_type,
class Disambiguate=
void>
33 template <
class other_dist>
47 template <
class mixture_type>
60 template <
class other_dist>
68 retval = mix.num_components();
75 template <
class mixture_type,
class Disambiguate=
void>
87 template <
class other_dist>
104 template <
class mixture_type>
117 template <
class other_dist>
128 if (idx < mix.num_components()){
129 retval = mix.weight(idx);
141 template <
class mixture_type,
class accessor_type,
class Disambiguate=
void>
153 template <
class other_dist,
class other_accessor = accessor_type>
173 template <
class mixture_type,
class accessor_type>
186 template <
class other_dist,
class other_accessor = accessor_type>
193 : accessor(), idx(index) {}
197 : accessor(a), idx(index) {}
202 if (idx < mix.num_components()){
203 return accessor(mix.distribution(idx),retval);
216 template <
class mixture_type>
232 template <
class other_dist,
class other_accessor = accessor_type>
248 if (idx < mix.num_components()){
249 retval = mix.weight(idx);
260 #endif // vpdt_mixture_accessors_h_ mixture_type distribution_type
the distribution operated on by the functor.
rebind this functor to another distribution type.
unsigned int idx
The component index.
vpdt_weight_accessor< typename mixture_type::component_type > accessor_type
the accessor type.
vpdt_mixture_accessor(unsigned int index=0)
Constructor.
rebind this functor to another distribution type.
vpdt_weight_accessor(unsigned int index=0)
Constructor.
mixture_type distribution_type
the distribution operated on by the functor.
A functor to return the number of components in a mixture.
A functor to return the weight of the component with given index.
rebind this functor to another distribution type.
mixture_type distribution_type
the distribution operated on by the functor.
unsigned int idx
The component index.
vpdt_dist_traits< mixture_type >::scalar_type return_type
the functor return type.
bool operator()(const mixture_type &mix, return_type &retval) const
The main function.
vpdt_mixture_accessor(unsigned int index=0)
Constructor.
vpdt_weight_accessor< other_dist > other
bool operator()(const mixture_type &mix, return_type &retval) const
The main function.
vpdt_num_components_accessor< other_dist > other
mixture_type distribution_type
the distribution operated on by the functor.
static const bool valid_functor
is this functor valid for its distribution type.
vpdt_mixture_accessor< other_dist, other_accessor > other
unsigned int return_type
the functor return type.
unsigned int return_type
the functor return type.
vpdt_mixture_accessor(unsigned int index=0)
Constructor.
accessor_type::return_type return_type
the functor return type.
vpdt_weight_accessor< other_dist > other
vpdt_dist_traits< mixture_type >::scalar_type return_type
the functor return type.
vpdt_mixture_accessor(const accessor_type &a, unsigned int index=0)
Constructor.
bool operator()(const mixture_type &mix, return_type &retval) const
The main function.
A functor to apply another functor to the component with given index.
vpdt_mixture_accessor< other_dist, other_accessor > other
static const bool valid_functor
is this functor valid for its distribution type.
mixture_type distribution_type
the distribution operated on by the functor.
vpdt_mixture_accessor(const accessor_type &a, unsigned int index=0)
Constructor.
vpdt_weight_accessor(unsigned int index=0)
Constructor.
mixture_type distribution_type
the distribution operated on by the functor.
static const bool valid_functor
is this functor valid for its distribution type.
accessor_type accessor
The accessor to apply.
vpdt_num_components_accessor< other_dist > other
vpdt_mixture_accessor< other_dist, other_accessor > other
unsigned int idx
The component index.
mixture_type distribution_type
the distribution operated on by the functor.
Use static booleans to control template instantiation.
vpdt_dist_traits< mixture_type >::scalar_type return_type
the functor return type.
accessor_type::return_type return_type
the functor return type.
specialized template trait classes for properties of a distribution type
vpdt_field_traits< field_type >::scalar_type scalar_type
The type used for scalar operations.
vpdt_mixture_accessor(const accessor_type &a, unsigned int index=0)
Constructor.