1 | // $Id: KernelWeighted_SEV.cc 527 2006-03-01 11:23:53Z peter $ |
---|
2 | |
---|
3 | #include <c++_tools/classifier/KernelWeighted_SEV.h> |
---|
4 | |
---|
5 | #include <c++_tools/classifier/DataLookup1D.h> |
---|
6 | #include <c++_tools/classifier/Kernel.h> |
---|
7 | #include <c++_tools/classifier/KernelFunction.h> |
---|
8 | #include <c++_tools/classifier/MatrixLookup.h> |
---|
9 | #include <c++_tools/gslapi/matrix.h> |
---|
10 | #include <c++_tools/gslapi/vector.h> |
---|
11 | |
---|
12 | namespace theplu { |
---|
13 | namespace classifier { |
---|
14 | |
---|
15 | |
---|
16 | KernelWeighted_SEV::KernelWeighted_SEV(const MatrixLookup& data, |
---|
17 | const KernelFunction& kf, |
---|
18 | const MatrixLookup& weights) |
---|
19 | : Kernel(data,kf), weights_(weights) |
---|
20 | { |
---|
21 | kernel_matrix_ = gslapi::matrix(data.columns(),data.columns()); |
---|
22 | for (size_t i=0; i<kernel_matrix_.rows(); i++) |
---|
23 | for (size_t j=i; j<kernel_matrix_.columns(); j++) |
---|
24 | kernel_matrix_(i,j) = kernel_matrix_(j,i) = |
---|
25 | (*kf_)(DataLookup1D(data_,i,false), |
---|
26 | DataLookup1D(data_,j,false), |
---|
27 | DataLookup1D(weights_,i,false), |
---|
28 | DataLookup1D(weights_,j,false)); |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | }} // of namespace classifier and namespace theplu |
---|