yat
0.8.3pre
|
00001 #ifndef _theplu_yat_classifier_kernel_ 00002 #define _theplu_yat_classifier_kernel_ 00003 00004 // $Id: Kernel.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2005 Jari Häkkinen, Peter Johansson 00008 Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér 00009 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 00010 Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér 00011 00012 This file is part of the yat library, http://dev.thep.lu.se/yat 00013 00014 The yat library is free software; you can redistribute it and/or 00015 modify it under the terms of the GNU General Public License as 00016 published by the Free Software Foundation; either version 3 of the 00017 License, or (at your option) any later version. 00018 00019 The yat library is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with yat. If not, see <http://www.gnu.org/licenses/>. 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 }; // class Kernel 00198 00199 }}} // of namespace classifier, yat, and theplu 00200 00201 #endif