source: trunk/lib/classifier/Kernel_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: 939 bytes
Line 
1// $Id: Kernel_SEV.cc 527 2006-03-01 11:23:53Z peter $
2
3#include <c++_tools/classifier/Kernel_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
16  Kernel_SEV::Kernel_SEV(const MatrixLookup& data, const KernelFunction& kf)
17    : Kernel(data,kf)
18  {
19    kernel_matrix_ = gslapi::matrix(data.columns(),data.columns());
20    for (size_t i=0; i<kernel_matrix_.rows(); i++) 
21      for (size_t j=i; j<kernel_matrix_.columns(); j++)
22        kernel_matrix_(i,j) = kernel_matrix_(j,i) =
23          (*kf_)(DataLookup1D(data_,i,false),DataLookup1D(data_,j,false));
24  }
25  double Kernel_SEV::element(const DataLookup1D& vec, const size_t i) const
26  { 
27    return kf_->operator()(vec, DataLookup1D(data_,i)); 
28  }
29
30
31}} // of namespace classifier and namespace theplu
Note: See TracBrowser for help on using the repository browser.