00001 #ifndef INDII_ML_AUX_KERNEL_HPP
00002 #define INDII_ML_AUX_KERNEL_HPP
00003
00004 #include "boost/serialization/serialization.hpp"
00005
00006 namespace indii {
00007 namespace ml {
00008 namespace aux {
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 class Kernel {
00022 public:
00023
00024
00025
00026
00027
00028
00029 Kernel();
00030
00031
00032
00033
00034
00035
00036 Kernel(const double h);
00037
00038
00039
00040
00041 virtual ~Kernel() = 0;
00042
00043
00044
00045
00046
00047
00048 double getBandwidth() const;
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 bool operator<(const Kernel& o) const;
00059
00060
00061
00062
00063
00064
00065
00066
00067 virtual double operator()(const double x) const = 0;
00068
00069 virtual double sample() const = 0;
00070
00071 private:
00072
00073
00074
00075 double h;
00076
00077
00078
00079
00080 template<class Archive>
00081 void serialize(Archive& ar, const unsigned int version);
00082
00083
00084
00085
00086 friend class boost::serialization::access;
00087
00088 };
00089
00090 }
00091 }
00092 }
00093
00094 inline double indii::ml::aux::Kernel::getBandwidth() const {
00095 return h;
00096 }
00097
00098 inline bool indii::ml::aux::Kernel::operator<(
00099 const indii::ml::aux::Kernel& o) const {
00100 return this->getBandwidth() < o.getBandwidth();
00101 }
00102
00103 template<class Archive>
00104 void indii::ml::aux::Kernel::serialize(Archive& ar,
00105 const unsigned int version) {
00106 ar & h;
00107 }
00108
00109 #endif
00110