yat  0.21pre
Kernel.h
1 #ifndef _theplu_yat_classifier_kernel_
2 #define _theplu_yat_classifier_kernel_
3 
4 // $Id: Kernel.h 4207 2022-08-26 04:36:28Z 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  Copyright (C) 2022 Peter Johansson
12 
13  This file is part of the yat library, http://dev.thep.lu.se/yat
14 
15  The yat library is free software; you can redistribute it and/or
16  modify it under the terms of the GNU General Public License as
17  published by the Free Software Foundation; either version 3 of the
18  License, or (at your option) any later version.
19 
20  The yat library is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with yat. If not, see <http://www.gnu.org/licenses/>.
27 */
28 
29 #include "KernelFunction.h"
30 
31 #include <cstddef>
32 #include <vector>
33 
34 namespace theplu {
35 namespace yat {
36 namespace classifier {
37 
38  class MatrixLookup;
39  class MatrixLookupWeighted;
40 
58  class Kernel
59  {
60 
61  public:
62 
73  Kernel(const MatrixLookup& data, const KernelFunction& kf,
74  const bool own=false);
75 
85  const bool own=false);
86 
91  Kernel(const Kernel& kernel, const std::vector<size_t>& index);
92 
99  virtual ~Kernel(void);
100 
105  virtual double operator()(const size_t row, const size_t column) const=0;
106 
112  const MatrixLookup& data(void) const;
113 
119  const MatrixLookupWeighted& data_weighted(void) const;
120 
126  double element(const DataLookup1D& vec, const size_t i) const;
127 
135  double element(const DataLookupWeighted1D& vec, const size_t i) const;
136 
145  virtual const Kernel* make_kernel(const MatrixLookup&, const bool) const=0;
146 
147 
156  virtual const Kernel* make_kernel(const MatrixLookupWeighted&,
157  const bool own=false) const=0;
158 
159 
163  size_t size(void) const;
164 
168  bool weighted(void) const;
169 
170  protected:
177 
182  unsigned int* ref_count_;
183 
188  unsigned int* ref_count_w_;
189 
190  private:
194  Kernel(const Kernel&);
195 
196  const Kernel& operator=(const Kernel&);
197 
198  }; // class Kernel
199 
200 }}} // of namespace classifier, yat, and theplu
201 
202 #endif
General view into utility::Matrix.
Definition: MatrixLookup.h:70
unsigned int * ref_count_w_
Definition: Kernel.h:188
const MatrixLookup * ml_
underlying data
Definition: Kernel.h:172
Interface Class for Kernels.
Definition: Kernel.h:58
double element(const DataLookup1D &vec, const size_t i) const
The Department of Theoretical Physics namespace as we define it.
Class for general vector view.
Definition: DataLookup1D.h:43
Interface class calculating elements in Kernel.
Definition: KernelFunction.h:38
size_t size(void) const
number of samples
const MatrixLookupWeighted & data_weighted(void) 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:176
General view into utility::MatrixWeighted.
Definition: MatrixLookupWeighted.h:63
virtual ~Kernel(void)
Destructor.
Kernel(const MatrixLookup &data, const KernelFunction &kf, const bool own=false)
virtual double operator()(const size_t row, const size_t column) const =0
Class for general weighted vector view.
Definition: DataLookupWeighted1D.h:43
const MatrixLookup & data(void) const
const MatrixLookupWeighted * mlw_
same as data_ if weifghted otherwise a NULL pointer
Definition: Kernel.h:174
unsigned int * ref_count_
Definition: Kernel.h:182

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14