source: trunk/lib/svm/Kernel.cc @ 295

Last change on this file since 295 was 295, checked in by Peter, 18 years ago

file structure modifications. NOTE, this revision is not working, please wait for the next...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 754 bytes
Line 
1// $Id: Kernel.cc 295 2005-04-29 09:15:58Z peter $
2
3#include <c++_tools/svm/Kernel.h>
4
5#include <c++_tools/svm/KernelFunction.h>
6#include <c++_tools/gslapi/matrix.h>
7#include <c++_tools/gslapi/vector.h>
8
9namespace theplu {
10namespace svm { 
11
12Kernel::Kernel(const gslapi::matrix& data, const KernelFunction& kf)
13  : k_(data.columns(),data.columns()), kf_(&kf), weighted_(false)
14{
15  k_ = kf(k_,data);
16  kf_=0;
17}
18
19Kernel::Kernel(const gslapi::matrix& data, const KernelFunction& kf, 
20               const gslapi::matrix& weight)
21  : k_(data.columns(),data.columns()), kf_(&kf), weighted_(true)
22{
23  for(u_int i=0;i<data.columns();i++)
24    for(u_int j=i;j<data.columns();j++)
25      k_(i,j)=k_(j,i)=kf(data[i],data[j],weight[i],weight[j]);
26 
27}
28
29
30Kernel::~Kernel(void)
31{
32} 
33
34}} // of namespace svm and namespace theplu
Note: See TracBrowser for help on using the repository browser.