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

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

fixed problem with ConsensusInputranker? - Now all tests do pass

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