Go to the documentation of this file.00001
00002 #ifndef bsta_parzen_sphere_h_
00003 #define bsta_parzen_sphere_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "bsta_parzen.h"
00020 #include <vcl_vector.h>
00021 #include <vcl_algorithm.h>
00022
00023
00024 template<class T, unsigned n, unsigned m> class vnl_matrix_fixed;
00025 template<class T, unsigned n> class vnl_vector_fixed;
00026
00027
00028
00029 template <class T, unsigned n>
00030 class bsta_parzen_sphere : public bsta_parzen<T,n>
00031 {
00032 public:
00033
00034
00035 typedef vnl_matrix_fixed<T,n,n> covar_type;
00036 typedef typename bsta_distribution<T,n>::vector_type vect_t;
00037 typedef typename bsta_distribution<T,n>::math_type math_t;
00038 bsta_parzen_sphere(): bandwidth_(T(1)),
00039 bandwidth_adapted_(false) {}
00040
00041 bsta_parzen_sphere(typename bsta_parzen<T,n>::sample_vector const& samples, T bandwidth = T(1)) :
00042 bsta_parzen<T,n>(samples), bandwidth_(bandwidth),
00043 bandwidth_adapted_(false){}
00044
00045 ~bsta_parzen_sphere() {}
00046
00047
00048 T bandwidth() const {return bandwidth_;}
00049
00050 void set_bandwidth(T bandwidth) { bandwidth_ = bandwidth; }
00051
00052 bool bandwidth_adapted() const { return bandwidth_adapted_; }
00053
00054 void set_bandwidth_adapted(bool bandwidth_adapted)
00055 {bandwidth_adapted_=bandwidth_adapted;}
00056
00057
00058 vnl_vector_fixed<T,n> mean() const;
00059
00060
00061 covar_type covar() const;
00062
00063
00064 T prob_density(vect_t const& pt) const;
00065
00066
00067 T probability(vect_t const& min_pt,
00068 vect_t const& max_pt) const;
00069
00070
00071 T nearest_sample(const vect_t& pt, unsigned & index) const;
00072
00073 protected:
00074 T bandwidth_;
00075 bool bandwidth_adapted_;
00076 };
00077
00078
00079 template <class T >
00080 class bsta_parzen_sphere<T,1> : public bsta_parzen<T,1>
00081 {
00082 public:
00083
00084 typedef typename bsta_distribution<T,1>::vector_type vect_t;
00085
00086 bsta_parzen_sphere(): bandwidth_(T(1)),
00087 bandwidth_adapted_(false) {}
00088
00089 bsta_parzen_sphere(typename bsta_parzen<T,1>::sample_vector const& samples,
00090 T bandwidth = T(1)): bsta_parzen<T,1>(samples),
00091 bandwidth_(bandwidth), bandwidth_adapted_(false){}
00092
00093 ~bsta_parzen_sphere() {}
00094
00095
00096 T bandwidth() const {return bandwidth_;}
00097
00098 void set_bandwidth(T bandwidth) { bandwidth_ = bandwidth; }
00099
00100 bool bandwidth_adapted() const { return bandwidth_adapted_; }
00101
00102 void set_bandwidth_adapted(bool bandwidth_adapted)
00103 {bandwidth_adapted_=bandwidth_adapted;}
00104
00105
00106 T mean() const;
00107
00108
00109 T covar() const;
00110
00111
00112 T prob_density(vect_t const& pt) const;
00113
00114
00115 T probability(vect_t const& min_pt,
00116 vect_t const& max_pt) const;
00117
00118
00119 T nearest_sample(const vect_t& pt, unsigned & index) const;
00120 protected:
00121 T bandwidth_;
00122 bool bandwidth_adapted_;
00123 };
00124
00125 #endif // bsta_parzen_sphere_h_