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

Last change on this file since 455 was 455, checked in by Markus Ringnér, 17 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_dataview_
4#define _theplu_classifier_dataview_
5
6#include <c++_tools/classifier/MatrixView.h>
7#include <c++_tools/gslapi/matrix.h>
8
9
10namespace theplu {
11namespace classifier { 
12
13  ///
14  /// Interface class for classifier data
15  ///
16
17  class DataView : public MatrixView
18  {
19 
20  public:
21
22
23    ///
24    /// Constructor
25    ///
26    DataView(const gslapi::matrix&);
27
28    ///
29    /// Constructor taking the row index vector and column index vector
30    /// as input.
31    ///
32    DataView(const gslapi::matrix&, const std::vector<size_t>&, 
33             const std::vector<size_t>&);
34
35    ///
36    /// Constructor taking the column (default) or row index vector
37    /// as input.
38    ///
39    DataView(const gslapi::matrix&, const std::vector<size_t>&, 
40             bool row=false);
41
42    ///
43    /// Copy constructor.
44    ///
45    DataView(const DataView&);
46
47    ///
48    /// Destructor
49    ///
50    ~DataView() {};
51
52   
53    inline double operator()(const size_t row, const size_t column) const
54    { return (*data_)(row_index_[row], column_index_[column]); }
55
56  private:
57    const gslapi::matrix* data_;
58  }; 
59 
60}} // of namespace classifier and namespace theplu
61
62#endif
Note: See TracBrowser for help on using the repository browser.