Go to the documentation of this file.00001
00002 #ifndef vpdl_gaussian_indep_h_
00003 #define vpdl_gaussian_indep_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <vpdl/vpdl_gaussian_base.h>
00016 #include <vcl_limits.h>
00017 #include <vcl_cassert.h>
00018
00019 #include <vpdl/vpdt/vpdt_gaussian.h>
00020 #include <vpdl/vpdt/vpdt_probability.h>
00021 #include <vpdl/vpdt/vpdt_log_probability.h>
00022
00023
00024 template<class T, unsigned int n=0>
00025 class vpdl_gaussian_indep : public vpdl_gaussian_base<T,n>
00026 {
00027 public:
00028
00029 typedef typename vpdt_field_default<T,n>::type vector;
00030
00031 typedef typename vpdt_field_traits<vector>::matrix_type matrix;
00032
00033 typedef vector covar_type;
00034
00035
00036
00037
00038 vpdl_gaussian_indep(unsigned int var_dim = n)
00039 : impl_(var_dim) {}
00040
00041
00042 vpdl_gaussian_indep(const vector& mean_val, const covar_type& var)
00043 : impl_(mean_val,var) {}
00044
00045
00046 virtual ~vpdl_gaussian_indep() {}
00047
00048
00049 virtual vpdl_distribution<T,n>* clone() const
00050 {
00051 return new vpdl_gaussian_indep<T,n>(*this);
00052 }
00053
00054
00055 virtual unsigned int dimension() const { return impl_.dimension(); }
00056
00057
00058 virtual T density(const vector& pt) const
00059 {
00060 return impl_.density(pt);
00061 }
00062
00063
00064 virtual T prob_density(const vector& pt) const
00065 {
00066 return vpdt_prob_density(impl_,pt);
00067 }
00068
00069
00070 virtual T log_prob_density(const vector& pt) const
00071 {
00072 return vpdt_log_prob_density(impl_,pt);
00073 };
00074
00075
00076
00077
00078
00079 virtual T gradient_density(const vector& pt, vector& g) const
00080 {
00081 return impl_.gradient_density(pt,g);
00082 }
00083
00084
00085
00086
00087 virtual T norm_const() const
00088 {
00089 return impl_.norm_const();
00090 }
00091
00092
00093
00094 T sqr_mahal_dist(const vector& pt) const
00095 {
00096 return impl_.sqr_mahal_dist(pt);
00097 }
00098
00099
00100
00101
00102 virtual T cumulative_prob(const vector& pt) const
00103 {
00104 return impl_.cumulative_prob(pt);
00105 }
00106
00107
00108 virtual const vector& mean() const { return impl_.mean; }
00109
00110
00111 virtual void set_mean(const vector& mean_val) { impl_.mean = mean_val; }
00112
00113
00114 virtual void compute_mean(vector& mean_val) const { mean_val = impl_.mean; }
00115
00116
00117 const covar_type& covariance() const { return impl_.covar; }
00118
00119
00120 void set_covariance(const covar_type& var) { impl_.covar = var; }
00121
00122
00123
00124 virtual void compute_covar(matrix& covar) const
00125 {
00126 impl_.compute_covar(covar);
00127 }
00128
00129 protected:
00130
00131 vpdt_gaussian<vector,covar_type> impl_;
00132 };
00133
00134 #endif // vpdl_gaussian_indep_h_