2 #ifndef vpdt_probability_h_ 3 #define vpdt_probability_h_ 24 # include <vcl_msvc_warnings.h> 34 T norm = d.norm_const();
37 return norm * d.density(pt);
52 const unsigned int dim = d.dimension();
55 for (
unsigned int j=0; j<dim; ++j) {
61 assert(
sizeof(
unsigned long)*8 > dim);
63 const unsigned long num_corners = 1 << dim;
67 for (
unsigned long i=0; i<num_corners; ++i)
72 bool plus = (dim%2 != 1);
74 for (
unsigned int j=0; j<dim; ++j) {
75 bool is_max = (i>>j) & 1;
80 prob += d.cumulative_prob(corner);
82 prob -= d.cumulative_prob(corner);
88 #endif // vpdt_probability_h_ vpdt_field_traits< typename dist::field_type >::field_type field_type
the data type to represent a point in the field.
vpdt_dist_traits< dist >::scalar_type vpdt_box_prob(const dist &d, const typename vpdt_dist_traits< dist >::field_type &min_pt, const typename vpdt_dist_traits< dist >::field_type &max_pt)
The probability of being in an axis-aligned box.
T & vpdt_index(vnl_vector< T > &v, unsigned int i)
Index into a vnl_vector.
vpdt_dist_traits< dist >::scalar_type vpdt_prob_density(const dist &d, const typename vpdt_dist_traits< dist >::field_type &pt)
Compute the probability from the density and normalization constant.
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.