source: trunk/yat/classifier/Kernel_MEV.cc @ 1706

Last change on this file since 1706 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.0 KB
Line 
1// $Id$
2
3/*
4  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
5  Copyright (C) 2008 Peter Johansson
6
7  This file is part of the yat library, http://dev.thep.lu.se/yat
8
9  The yat library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 3 of the
12  License, or (at your option) any later version.
13
14  The yat library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with yat. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include "Kernel_MEV.h"
24#include "DataLookup1D.h"
25#include "DataLookupWeighted1D.h"
26
27namespace theplu {
28namespace yat {
29namespace classifier { 
30
31  Kernel_MEV::Kernel_MEV(const MatrixLookup& data, const KernelFunction& kf,
32                         const bool own)
33    : Kernel(data,kf,own) 
34  {
35  }
36
37
38  Kernel_MEV::Kernel_MEV(const MatrixLookupWeighted& data, 
39                         const KernelFunction& kf, const bool own)
40    : Kernel(data,kf,own) 
41  {
42  }
43
44
45  Kernel_MEV::Kernel_MEV(const Kernel_MEV& kernel, 
46                         const std::vector<size_t>& index)
47    : Kernel(kernel,index)
48  {
49  }
50
51
52  const Kernel_MEV* Kernel_MEV::make_kernel(const MatrixLookup& data, 
53                                            const bool own) const
54  {
55    return new Kernel_MEV(data, *kf_, own);
56  }
57
58
59  const Kernel_MEV* Kernel_MEV::make_kernel(const MatrixLookupWeighted& data, 
60                                            const bool own) const
61  {
62    return new Kernel_MEV(data, *kf_, own);
63  }
64
65
66  double Kernel_MEV::operator()(const size_t row, const size_t column) const
67  { 
68    if (weighted())
69      return (*kf_)(DataLookupWeighted1D(*mlw_,row,false),
70                    DataLookupWeighted1D(*mlw_,column,false)); 
71    else
72      return (*kf_)(DataLookup1D(*ml_,row,false),
73                    DataLookup1D(*ml_,column,false)); 
74  }
75
76
77
78}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.