yat  0.14.5pre
Kernel.h
1 #ifndef _theplu_yat_classifier_kernel_
2 #define _theplu_yat_classifier_kernel_
3 
4 // $Id: Kernel.h 2119 2009-12-12 23:11:43Z peter $
5 
6 /*
7  Copyright (C) 2005 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
9  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
10  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
11 
12  This file is part of the yat library, http://dev.thep.lu.se/yat
13 
14  The yat library is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License as
16  published by the Free Software Foundation; either version 3 of the
17  License, or (at your option) any later version.
18 
19  The yat library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with yat. If not, see <http://www.gnu.org/licenses/>.
26 */
27 
28 #include "KernelFunction.h"
29 
30 #include <cstddef>
31 #include <vector>
32 
33 namespace theplu {
34 namespace yat {
35 namespace classifier {
36 
37  class MatrixLookup;
38  class MatrixLookupWeighted;
39 
57  class Kernel
58  {
59 
60  public:
61 
72  Kernel(const MatrixLookup& data, const KernelFunction& kf,
73  const bool own=false);
74 
83  Kernel(const MatrixLookupWeighted& data, const KernelFunction& kf,
84  const bool own=false);
85 
90  Kernel(const Kernel& kernel, const std::vector<size_t>& index);
91 
98  virtual ~Kernel(void);
99 
104  virtual double operator()(const size_t row, const size_t column) const=0;
105 
111  const MatrixLookup& data(void) const;
112 
118  const MatrixLookupWeighted& data_weighted(void) const;
119 
125  double element(const DataLookup1D& vec, const size_t i) const;
126 
134  double element(const DataLookupWeighted1D& vec, const size_t i) const;
135 
144  virtual const Kernel* make_kernel(const MatrixLookup&, const bool) const=0;
145 
146 
155  virtual const Kernel* make_kernel(const MatrixLookupWeighted&,
156  const bool own=false) const=0;
157 
158 
162  size_t size(void) const;
163 
167  bool weighted(void) const;
168 
169  protected:
176 
181  unsigned int* ref_count_;
182 
187  unsigned int* ref_count_w_;
188 
189  private:
193  Kernel(const Kernel&);
194 
195  const Kernel& operator=(const Kernel&);
196 
197  }; // class Kernel
198 
199 }}} // of namespace classifier, yat, and theplu
200 
201 #endif
General view into utility::Matrix.
Definition: MatrixLookup.h:70
unsigned int * ref_count_w_
Definition: Kernel.h:187
const MatrixLookup * ml_
underlying data
Definition: Kernel.h:171
const MatrixLookupWeighted & data_weighted(void) const
Interface Class for Kernels.
Definition: Kernel.h:57
Class for general vector view.
Definition: DataLookup1D.h:43
Interface class calculating elements in Kernel.
Definition: KernelFunction.h:37
double element(const DataLookup1D &vec, const size_t i) const
virtual const Kernel * make_kernel(const MatrixLookup &, const bool) const =0
const KernelFunction * kf_
type of Kernel Function e.g. Gaussian (aka RBF)
Definition: Kernel.h:175
size_t size(void) const
number of samples
General view into utility::MatrixWeighted.
Definition: MatrixLookupWeighted.h:63
virtual ~Kernel(void)
Destructor.
Kernel(const MatrixLookup &data, const KernelFunction &kf, const bool own=false)
const MatrixLookup & data(void) const
virtual double operator()(const size_t row, const size_t column) const =0
Class for general weighted vector view.
Definition: DataLookupWeighted1D.h:43
const MatrixLookupWeighted * mlw_
same as data_ if weifghted otherwise a NULL pointer
Definition: Kernel.h:173
unsigned int * ref_count_
Definition: Kernel.h:181

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5