vpdt_distribution_accessors.h
Go to the documentation of this file.
1 // This is core/vpdl/vpdt/vpdt_distribution_accessors.h
2 #ifndef vpdt_distribution_accessors_h_
3 #define vpdt_distribution_accessors_h_
4 //:
5 // \file
6 // \brief Accessor functors that apply to all distributions
7 // \author Matt Leotta (mleotta@lems.brown.edu)
8 // \date March 15, 2009
9 //
10 // \verbatim
11 // Modifications
12 // (none yet)
13 // \endverbatim
14 
16 
17 
18 //: An accessor to return the variable dimension of the distribution
19 template <class dist_type>
21 {
22 public:
23  //: the functor return type
24  typedef unsigned int return_type;
25  //: the distribution operated on by the functor
26  typedef dist_type distribution_type;
27  //: is this functor valid for its distribution type
28  static const bool valid_functor = true;
29 
30  //: rebind this functor to another distribution type
31  template <class other_dist>
32  struct rebind {
34  };
35 
36  //: The main function
37  bool operator() ( const dist_type& d, return_type& retval ) const
38  {
39  retval = d.dimension();
40  return true;
41  }
42 };
43 
44 
45 //: An accessor to return the mean of the distribution
46 template <class dist_type>
48 {
49 public:
50  //: the functor return type
51  typedef typename dist_type::field_type return_type;
52  //: the distribution operated on by the functor
53  typedef dist_type distribution_type;
54  //: is this functor valid for its distribution type
55  static const bool valid_functor = true;
56 
57  //: rebind this functor to another distribution type
58  template <class other_dist>
59  struct rebind {
61  };
62 
63  //: The main function
64  bool operator() ( const dist_type& d, return_type& retval ) const
65  {
66  d.compute_mean(retval);
67  return true;
68  }
69 };
70 
71 
72 //: An accessor to return the covariance of the distribution
73 template <class dist_type>
75 {
76 public:
77  //: the functor return type
79  //: the distribution operated on by the functor
80  typedef dist_type distribution_type;
81  //: is this functor valid for its distribution type
82  static const bool valid_functor = true;
83 
84  //: rebind this functor to another distribution type
85  template <class other_dist>
86  struct rebind {
88  };
89 
90  //: The main function
91  bool operator() ( const dist_type& d, return_type& retval ) const
92  {
93  d.compute_covar(retval);
94  return true;
95  }
96 };
97 
98 
99 //: An accessor to return the normalization constant of the distribution
100 template <class dist_type>
102 {
103 public:
104  //: the functor return type
106  //: the distribution operated on by the functor
107  typedef dist_type distribution_type;
108  //: is this functor valid for its distribution type
109  static const bool valid_functor = true;
110 
111  //: rebind this functor to another distribution type
112  template <class other_dist>
113  struct rebind {
115  };
116 
117  //: The main function
118  bool operator() ( const dist_type& d, return_type& retval ) const
119  {
120  retval = d.norm_const();
121  return true;
122  }
123 };
124 
125 
126 #endif // vpdt_distribution_accessors_h_
dist_type distribution_type
the distribution operated on by the functor.
vpdt_mean_accessor< other_dist > other
vpdt_norm_const_accessor< other_dist > other
vpdt_covar_accessor< other_dist > other
dist_type::field_type return_type
the functor return type.
bool operator()(const dist_type &d, return_type &retval) const
The main function.
rebind this functor to another distribution type.
An accessor to return the covariance of the distribution.
An accessor to return the variable dimension of the distribution.
static const bool valid_functor
is this functor valid for its distribution type.
An accessor to return the normalization constant of the distribution.
bool operator()(const dist_type &d, return_type &retval) const
The main function.
An accessor to return the mean of the distribution.
unsigned int return_type
the functor return type.
vpdt_field_traits< field_type >::matrix_type matrix_type
the data type used for square matrices.
dist_type distribution_type
the distribution operated on by the functor.
vpdt_dist_traits< dist_type >::scalar_type return_type
the functor return type.
static const bool valid_functor
is this functor valid for its distribution type.
vpdt_dimension_accessor< other_dist > other
rebind this functor to another distribution type.
bool operator()(const dist_type &d, return_type &retval) const
The main function.
dist_type distribution_type
the distribution operated on by the functor.
rebind this functor to another distribution type.
rebind this functor to another distribution 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.
static const bool valid_functor
is this functor valid for its distribution type.
vpdt_dist_traits< dist_type >::matrix_type return_type
the functor return type.
dist_type distribution_type
the distribution operated on by the functor.
static const bool valid_functor
is this functor valid for its distribution type.
bool operator()(const dist_type &d, return_type &retval) const
The main function.