00001 #ifndef _theplu_yat_classifier_kernel_
00002 #define _theplu_yat_classifier_kernel_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "KernelFunction.h"
00029
00030 #include <cstddef>
00031 #include <vector>
00032
00033 namespace theplu {
00034 namespace yat {
00035 namespace classifier {
00036
00037 class MatrixLookup;
00038 class MatrixLookupWeighted;
00039
00057 class Kernel
00058 {
00059
00060 public:
00061
00072 Kernel(const MatrixLookup& data, const KernelFunction& kf,
00073 const bool own=false);
00074
00083 Kernel(const MatrixLookupWeighted& data, const KernelFunction& kf,
00084 const bool own=false);
00085
00090 Kernel(const Kernel& kernel, const std::vector<size_t>& index);
00091
00098 virtual ~Kernel(void);
00099
00104 virtual double operator()(const size_t row, const size_t column) const=0;
00105
00111 const MatrixLookup& data(void) const;
00112
00118 const MatrixLookupWeighted& data_weighted(void) const;
00119
00125 double element(const DataLookup1D& vec, const size_t i) const;
00126
00134 double element(const DataLookupWeighted1D& vec, const size_t i) const;
00135
00144 virtual const Kernel* make_kernel(const MatrixLookup&, const bool) const=0;
00145
00146
00155 virtual const Kernel* make_kernel(const MatrixLookupWeighted&,
00156 const bool own=false) const=0;
00157
00158
00162 size_t size(void) const;
00163
00167 bool weighted(void) const;
00168
00169 protected:
00171 const MatrixLookup* ml_;
00173 const MatrixLookupWeighted* mlw_;
00175 const KernelFunction* kf_;
00176
00181 unsigned int* ref_count_;
00182
00187 unsigned int* ref_count_w_;
00188
00189 private:
00193 Kernel(const Kernel&);
00194
00195 const Kernel& operator=(const Kernel&);
00196
00197 };
00198
00199 }}}
00200
00201 #endif