source: trunk/lib/classifier/Kernel_MEV.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 Author Date Id Revision
File size: 2.0 KB
Line 
1// $Id: Kernel_MEV.h 512 2006-02-18 15:06:11Z peter $
2
3#ifndef _theplu_classifier_kernel_mev_
4#define _theplu_classifier_kernel_mev_
5
6#include <c++_tools/classifier/Kernel.h>
7#include <c++_tools/classifier/KernelFunction.h>
8#include <c++_tools/gslapi/vector.h>
9#include <c++_tools/gslapi/matrix.h>
10
11namespace theplu {
12namespace classifier {
13
14  ///
15  ///   @brief Memory Efficient Kernel
16  ///   Class taking care of the \f$NxN\f$ kernel matrix, where
17  ///   \f$N\f$ is number of samples. Type of Kernel is defined by a
18  ///   KernelFunction. This Memory Efficient Version (MEV) does not
19  ///   store the kernel matrix in memory, but calculates each element
20  ///   when it is needed. When memory allows do always use Kernel_SEV
21  ///   instead.
22  ///   
23  ///   @see also Kernel_SEV
24  ///
25  class Kernel_MEV : public Kernel
26  {
27   
28  public:
29   
30    ///
31    ///   Constructor taking the data matrix and KernelFunction as
32    ///   input.Each column in the data matrix corresponds to one
33    ///   sample. @note Can not handle NaNs.
34    ///
35    inline Kernel_MEV(const gslapi::matrix& data, const KernelFunction& kf)
36      : Kernel(data,kf) {}
37
38    ///
39    ///   @todo Constructor taking the \a data matrix, the KernelFunction and a
40    ///   \a weight matrix as input. Each column in the data matrix
41    ///   corresponds to one sample.
42    Kernel_MEV(const gslapi::matrix& data, const KernelFunction&, 
43               const gslapi::matrix& weight);
44
45    ///
46    /// Copy constructor (not implemented)
47    ///
48    Kernel_MEV(const Kernel_MEV&);
49
50    ///
51    ///   Destructor
52    ///
53    inline virtual ~Kernel_MEV(void) {};
54
55    ///
56    /// @return Element at position (\a row, \a column) of the Kernel
57    /// matrix
58    ///
59    inline double operator()(const size_t row, const size_t column) const
60      { return (*kf_)(gslapi::vector(data_,row,false),
61                      gslapi::vector(data_,column,false)); }
62
63    ///
64    /// @brief number of samples
65    ///
66    inline size_t size(void) const { return data_.columns(); } 
67
68  private:
69
70  }; // class Kernel_MEV
71
72}} // of namespace classifier and namespace theplu
73
74#endif
Note: See TracBrowser for help on using the repository browser.