source: trunk/lib/classifier/KernelWeighted_SEV.cc @ 527

Last change on this file since 527 was 527, checked in by Peter, 16 years ago

Modified Kernel to be built from MatrixLookup? rather than
gslapi::matrix. Also changed interface to create DataLookup1D from
DataLookup2D - is now coherent with gslapi.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 998 bytes
Line 
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
12namespace theplu {
13namespace classifier { 
14
15
16KernelWeighted_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
Note: See TracBrowser for help on using the repository browser.