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

Last change on this file since 1797 was 1797, checked in by Peter, 13 years ago

updating copyright statements

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