528 |
01 Mar 06 |
peter |
// $Id$ |
528 |
01 Mar 06 |
peter |
2 |
|
675 |
10 Oct 06 |
jari |
3 |
/* |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2012 Peter Johansson |
528 |
01 Mar 06 |
peter |
8 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
528 |
01 Mar 06 |
peter |
10 |
|
675 |
10 Oct 06 |
jari |
The yat library is free software; you can redistribute it and/or |
675 |
10 Oct 06 |
jari |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
675 |
10 Oct 06 |
jari |
License, or (at your option) any later version. |
675 |
10 Oct 06 |
jari |
15 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be useful, |
675 |
10 Oct 06 |
jari |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
10 Oct 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
675 |
10 Oct 06 |
jari |
General Public License for more details. |
675 |
10 Oct 06 |
jari |
20 |
|
675 |
10 Oct 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
675 |
10 Oct 06 |
jari |
23 |
*/ |
675 |
10 Oct 06 |
jari |
24 |
|
2881 |
18 Nov 12 |
peter |
25 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
26 |
|
680 |
11 Oct 06 |
jari |
27 |
#include "Kernel_MEV.h" |
680 |
11 Oct 06 |
jari |
28 |
#include "DataLookup1D.h" |
680 |
11 Oct 06 |
jari |
29 |
#include "DataLookupWeighted1D.h" |
675 |
10 Oct 06 |
jari |
30 |
|
528 |
01 Mar 06 |
peter |
31 |
namespace theplu { |
680 |
11 Oct 06 |
jari |
32 |
namespace yat { |
4200 |
19 Aug 22 |
peter |
33 |
namespace classifier { |
528 |
01 Mar 06 |
peter |
34 |
|
658 |
25 Sep 06 |
peter |
35 |
Kernel_MEV::Kernel_MEV(const MatrixLookup& data, const KernelFunction& kf, |
658 |
25 Sep 06 |
peter |
36 |
const bool own) |
4200 |
19 Aug 22 |
peter |
37 |
: Kernel(data,kf,own) |
628 |
05 Sep 06 |
peter |
38 |
{ |
628 |
05 Sep 06 |
peter |
39 |
} |
628 |
05 Sep 06 |
peter |
40 |
|
628 |
05 Sep 06 |
peter |
41 |
|
4200 |
19 Aug 22 |
peter |
42 |
Kernel_MEV::Kernel_MEV(const MatrixLookupWeighted& data, |
658 |
25 Sep 06 |
peter |
43 |
const KernelFunction& kf, const bool own) |
4200 |
19 Aug 22 |
peter |
44 |
: Kernel(data,kf,own) |
628 |
05 Sep 06 |
peter |
45 |
{ |
628 |
05 Sep 06 |
peter |
46 |
} |
628 |
05 Sep 06 |
peter |
47 |
|
628 |
05 Sep 06 |
peter |
48 |
|
4200 |
19 Aug 22 |
peter |
49 |
Kernel_MEV::Kernel_MEV(const Kernel_MEV& kernel, |
545 |
06 Mar 06 |
peter |
50 |
const std::vector<size_t>& index) |
545 |
06 Mar 06 |
peter |
51 |
: Kernel(kernel,index) |
545 |
06 Mar 06 |
peter |
52 |
{ |
545 |
06 Mar 06 |
peter |
53 |
} |
545 |
06 Mar 06 |
peter |
54 |
|
545 |
06 Mar 06 |
peter |
55 |
|
4200 |
19 Aug 22 |
peter |
56 |
const Kernel_MEV* Kernel_MEV::make_kernel(const MatrixLookup& data, |
658 |
25 Sep 06 |
peter |
57 |
const bool own) const |
658 |
25 Sep 06 |
peter |
58 |
{ |
658 |
25 Sep 06 |
peter |
59 |
return new Kernel_MEV(data, *kf_, own); |
658 |
25 Sep 06 |
peter |
60 |
} |
658 |
25 Sep 06 |
peter |
61 |
|
658 |
25 Sep 06 |
peter |
62 |
|
4200 |
19 Aug 22 |
peter |
63 |
const Kernel_MEV* Kernel_MEV::make_kernel(const MatrixLookupWeighted& data, |
658 |
25 Sep 06 |
peter |
64 |
const bool own) const |
658 |
25 Sep 06 |
peter |
65 |
{ |
658 |
25 Sep 06 |
peter |
66 |
return new Kernel_MEV(data, *kf_, own); |
658 |
25 Sep 06 |
peter |
67 |
} |
658 |
25 Sep 06 |
peter |
68 |
|
658 |
25 Sep 06 |
peter |
69 |
|
528 |
01 Mar 06 |
peter |
70 |
double Kernel_MEV::operator()(const size_t row, const size_t column) const |
4200 |
19 Aug 22 |
peter |
71 |
{ |
1163 |
26 Feb 08 |
peter |
72 |
if (weighted()) |
1163 |
26 Feb 08 |
peter |
73 |
return (*kf_)(DataLookupWeighted1D(*mlw_,row,false), |
4200 |
19 Aug 22 |
peter |
74 |
DataLookupWeighted1D(*mlw_,column,false)); |
628 |
05 Sep 06 |
peter |
75 |
else |
1163 |
26 Feb 08 |
peter |
76 |
return (*kf_)(DataLookup1D(*ml_,row,false), |
4200 |
19 Aug 22 |
peter |
77 |
DataLookup1D(*ml_,column,false)); |
528 |
01 Mar 06 |
peter |
78 |
} |
528 |
01 Mar 06 |
peter |
79 |
|
545 |
06 Mar 06 |
peter |
80 |
|
545 |
06 Mar 06 |
peter |
81 |
|
680 |
11 Oct 06 |
jari |
82 |
}}} // of namespace classifier, yat, and theplu |