Last change
on this file since 330 was
330,
checked in by Peter, 18 years ago
|
added an abstract base class for Kernel from which Kernel_SEV Kernel_MEV are inherited. Also added a separate class for viewing into subKernels
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | // $Id: KernelView.h 330 2005-06-01 21:30:47Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_svm_kernel_view_ |
---|
4 | #define _theplu_svm_kernel_view_ |
---|
5 | |
---|
6 | #include <c++_tools/svm/Kernel.h> |
---|
7 | #include <vector> |
---|
8 | |
---|
9 | namespace theplu { |
---|
10 | namespace svm { |
---|
11 | |
---|
12 | class KernelFunction; |
---|
13 | |
---|
14 | /// |
---|
15 | /// @brief View into sub Kernel |
---|
16 | /// When training |
---|
17 | /// |
---|
18 | class KernelView : public Kernel |
---|
19 | { |
---|
20 | |
---|
21 | public: |
---|
22 | |
---|
23 | /// |
---|
24 | /// Contructor taking the Kernel to view into and a vector of the |
---|
25 | /// indeces we view into. If Kernel is a KernelView it implemented |
---|
26 | /// to view into something that is viewing into... and may |
---|
27 | /// therefore be slow. Use instead the original Kernel and view |
---|
28 | /// directly into that. |
---|
29 | /// |
---|
30 | KernelView(const Kernel&, const std::vector<size_t>&); |
---|
31 | |
---|
32 | /// |
---|
33 | /// @todo |
---|
34 | /// Copy constructor |
---|
35 | /// |
---|
36 | KernelView(const KernelView&); |
---|
37 | |
---|
38 | /// |
---|
39 | /// Destructor |
---|
40 | /// |
---|
41 | virtual ~KernelView(void); |
---|
42 | |
---|
43 | /// |
---|
44 | /// @return element at position (\a row, \a column) in the Kernel |
---|
45 | /// matrix |
---|
46 | /// |
---|
47 | inline double operator()(const size_t row,const size_t column) const |
---|
48 | { return (*kernel_)(index[row],index[column]); } |
---|
49 | |
---|
50 | private: |
---|
51 | const Kernel* kernel_; |
---|
52 | const std::vector<size_t>& index_; |
---|
53 | |
---|
54 | |
---|
55 | inline bool is_view(void) const { return true; } |
---|
56 | |
---|
57 | }; // class KernelView |
---|
58 | |
---|
59 | }} // of namespace svm and namespace theplu |
---|
60 | |
---|
61 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.