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

add KernelView? in makefile and small fixes


Property svn:eolstyle set to
native

Property svn:keywords set to
Id

File size:
1.5 KB

Line  

1  // $Id: KernelView.h 331 20050601 22:06:51Z 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. The constructed Kernel matrix will have 

26  /// dimensions \f$NxN\f$ where \f$N\f$ is the size of \a index. If 

27  /// Kernel is a KernelView, as now it implemented to view into the 

28  /// view rather directly into the original Kernel, and may 

29  /// therefore be slow. Use instead the original Kernel and view 

30  /// directly into that. 

31  /// 

32  KernelView(const Kernel& kernel, const std::vector<size_t>& index); 

33  

34  /// 

35  /// @todo 

36  /// Copy constructor 

37  /// 

38  KernelView(const KernelView&); 

39  

40  /// 

41  /// Destructor 

42  /// 

43  virtual ~KernelView(void); 

44  

45  /// 

46  /// @return element at position (\a row, \a column) in the Kernel 

47  /// matrix 

48  /// 

49  inline double operator()(const size_t row,const size_t column) const 

50  { return (*kernel_)(index_[row],index_[column]); } 

51  

52  /// 

53  /// @brief number of samples 

54  /// 

55  size_t size(void) const { return index_.size(); } 

56  

57  

58  private: 

59  const Kernel* kernel_; 

60  const std::vector<size_t>& index_; 

61  

62  

63  inline bool is_view(void) const { return true; } 

64  

65  }; // class KernelView 

66  

67  }} // of namespace svm and namespace theplu 

68  

69  #endif 

Note: See
TracBrowser
for help on using the repository browser.