source: trunk/lib/classifier/MatrixView.h @ 455

Last change on this file since 455 was 455, checked in by Markus Ringnér, 16 years ago

Adding classes to support general views of matrices (and kernels). Will be useful for cross-validation and ensembles of classifiers

File size: 1.1 KB
Line 
1// $Id$
2
3#ifndef _theplu_classifier_matrixview_
4#define _theplu_classifier_matrixview_
5
6#include <vector>
7
8namespace theplu {
9namespace classifier { 
10
11  ///
12  /// Interface class for classifier data
13  ///
14
15  class MatrixView
16  {
17 
18  public:
19
20    ///
21    /// Constructor taking the row index vector and column index vector
22    /// as input.
23    ///
24    MatrixView(const std::vector<size_t>&, const std::vector<size_t>&);
25
26    ///
27    /// Constructor taking the row index vector or
28    /// column index vector (default)
29    ///
30    MatrixView(const std::vector<size_t>&, bool row=false);
31
32
33    ///
34    /// Copy constructor.
35    ///
36    MatrixView(const MatrixView&);
37
38    ///
39    /// Destructor
40    ///
41    virtual ~MatrixView() {};
42
43    inline size_t columns(void) const { return column_index_.size(); } 
44
45    inline size_t rows(void) const { return row_index_.size(); } 
46
47    virtual double operator()(const size_t row, const size_t column) const=0;
48
49  protected:
50    std::vector<size_t> row_index_;
51    std::vector<size_t> column_index_;
52   
53    ///
54    /// Default constructor.
55    ///
56    MatrixView() {};
57
58  }; 
59 
60}} // of namespace classifier and namespace theplu
61
62#endif
Note: See TracBrowser for help on using the repository browser.