source: trunk/lib/classifier/Kernel.h @ 512

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

moved common member variables to base class Kernel

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: Kernel.h 512 2006-02-18 15:06:11Z peter $
2
3#ifndef _theplu_classifier_kernel_
4#define _theplu_classifier_kernel_
5
6#include <cctype>
7
8namespace theplu {
9
10namespace gslapi {
11  class matrix;
12}
13
14namespace classifier {
15
16  class KernelFunction;
17
18  ///
19  ///   @brief Base Class for Kernels.
20  ///
21  ///   Class taking care of the \f$NxN\f$ kernel matrix, where
22  ///   \f$N\f$ is number of samples. Each element in the Kernel
23  ///   matrix is the scalar product of the corresponding pair of
24  ///   samples. Type of Kernel is defined by a KernelFunction.
25  ///   
26  ///   @note If the KernelFunction is destroyed, the Kernel is no
27  ///   longer defined.
28  ///
29  class Kernel
30  {
31   
32  public:
33
34    ///
35    /// Default constructor
36    ///
37    //Kernel(void) {};
38
39    ///
40    /// Copy constructor (not implemented)
41    ///
42    Kernel(const Kernel&);
43
44    ///
45    ///   Constructor taking the data matrix and KernelFunction as
46    ///   input.Each column in the data matrix corresponds to one
47    ///   sample. @note Can not handle NaNs.
48    ///
49    Kernel(const gslapi::matrix& data, const KernelFunction& kf) 
50      : data_(data), kf_(&kf) {};
51   
52    ///
53    ///   Destructor
54    ///
55    virtual ~Kernel(void) {};
56
57    ///
58    /// @return element at position (\a row, \a column) of the Kernel
59    /// matrix
60    ///
61    virtual double operator()(const size_t row,const size_t column) const=0;
62
63    ///
64    /// @brief number of samples
65    ///
66    virtual size_t size(void) const=0;
67   
68  protected:
69    const gslapi::matrix& data_;
70    const KernelFunction* kf_;
71
72  }; // class Kernel
73
74}} // of namespace classifier and namespace theplu
75
76#endif
Note: See TracBrowser for help on using the repository browser.