Go to the documentation of this file.00001
00002 #ifndef bsta_von_mises_h_
00003 #define bsta_von_mises_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "bsta_distribution.h"
00020 #include <vcl_vector.h>
00021 #include <vcl_iostream.h>
00022
00023
00024 template <class T, unsigned n>
00025 class bsta_von_mises : public bsta_distribution<T,n>
00026 {
00027 public:
00028 typedef typename bsta_distribution<T,n>::vector_type vector_type;
00029 typedef typename bsta_distribution<T,n>::math_type math_type;
00030 typedef typename bsta_distribution<T,n>::field_type field_type;
00031 enum { data_dimension = n };
00032 bsta_von_mises(): mean_(vector_type(T(0))), kappa_(T(1)) {}
00033 bsta_von_mises(vector_type const& mean, T kappa): mean_(mean), kappa_(kappa) {}
00034 virtual ~bsta_von_mises() {}
00035
00036 const vector_type& mean() const {return mean_;}
00037 void set_mean(const vector_type& mean) {mean_ = mean;}
00038
00039
00040 T kappa() const {return kappa_;}
00041 void set_kappa(T kappa) {kappa_=kappa;}
00042
00043
00044 T prob_density(vector_type const& v) const{vcl_cerr << "not implemented\n"; return 0;}
00045
00046
00047 T probability(vector_type const& v,const T theta_max) const {vcl_cerr << "not implemented\n"; return 0;}
00048
00049 protected:
00050
00051 vector_type mean_;
00052
00053 T kappa_;
00054 };
00055
00056
00057 #if VCL_CAN_DO_PARTIAL_SPECIALIZATION
00058 template <class T>
00059 class bsta_von_mises<T,3>
00060 {
00061 public:
00062 typedef typename bsta_distribution<T,3>::math_type math_type;
00063 typedef typename bsta_distribution<T,3>::vector_type vector_type;
00064 typedef typename bsta_distribution<T,3>::field_type field_type;
00065 enum { data_dimension = 3 };
00066 bsta_von_mises(): mean_(vector_type(T(0))), kappa_(T(1)) {mean_[2]=T(1);}
00067 bsta_von_mises(vector_type const& mean, T kappa): mean_(mean), kappa_(kappa) {}
00068 virtual ~bsta_von_mises() {}
00069
00070 const vector_type& mean() const {return mean_;}
00071 void set_mean(const vector_type& mean) { mean_ = mean; }
00072
00073
00074 T kappa() const {return kappa_;}
00075 void set_kappa(T kappa) {kappa_=kappa;}
00076
00077 T prob_density(vector_type const& v) const;
00078
00079
00080
00081 T probability(vector_type const& v,const T theta_max) const;
00082
00083 protected:
00084
00085 vector_type mean_;
00086
00087 T kappa_;
00088 };
00089
00090
00091 template <class T>
00092 class bsta_von_mises<T,2>
00093 {
00094 public:
00095 typedef typename bsta_distribution<T,2>::math_type math_type;
00096 typedef typename bsta_distribution<T,2>::vector_type vector_type;
00097 typedef typename bsta_distribution<T,2>::field_type field_type;
00098 enum { data_dimension = 2 };
00099 bsta_von_mises(): mean_(vector_type(T(0))), kappa_(T(1)) { mean_[1]=T(1); }
00100 bsta_von_mises(vector_type const& mean, T kappa): mean_(mean), kappa_(kappa) {}
00101 virtual ~bsta_von_mises() {}
00102
00103 const vector_type& mean() const {return mean_;}
00104 void set_mean(const vector_type& mean) {mean_ = mean;}
00105
00106
00107 T kappa() const {return kappa_;}
00108 void set_kappa(T kappa) {kappa_=kappa;}
00109
00110
00111 T prob_density(vector_type const& v) const;
00112
00113
00114 T probability(vector_type const& ,const T ) const {vcl_cerr << "not implemented\n"; return 0;}
00115
00116 protected:
00117
00118 vector_type mean_;
00119
00120 T kappa_;
00121 };
00122
00123 #endif //VCL_CAN_DO_PARTIAL_SPECIALIZATION
00124
00125 template <class T , unsigned n>
00126 inline vcl_ostream& operator<< (vcl_ostream& os,
00127 bsta_von_mises<T, n> const& vm)
00128 {
00129 os << "von_mises:mean(" << vm.mean() << ")\n"
00130 << "von_mises:kappa(" << vm.kappa() << ")\n";
00131 return os;
00132 }
00133 #endif // bsta_von_mises_h_