1 | // $Id$ |
---|
2 | |
---|
3 | #ifndef _theplu_classifier_matrix_lookup_ |
---|
4 | #define _theplu_classifier_matrix_lookup_ |
---|
5 | |
---|
6 | #include <c++_tools/classifier/DataLookup2D.h> |
---|
7 | #include <c++_tools/gslapi/matrix.h> |
---|
8 | |
---|
9 | |
---|
10 | namespace theplu { |
---|
11 | namespace classifier { |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | /// |
---|
16 | /// Interface class for classifier data |
---|
17 | /// |
---|
18 | |
---|
19 | class MatrixLookup : public DataLookup2D |
---|
20 | { |
---|
21 | |
---|
22 | public: |
---|
23 | |
---|
24 | |
---|
25 | /// |
---|
26 | /// Constructor |
---|
27 | /// |
---|
28 | MatrixLookup(const gslapi::matrix&); |
---|
29 | |
---|
30 | /// |
---|
31 | /// Constructor taking the row index vector and column index vector |
---|
32 | /// as input. |
---|
33 | /// |
---|
34 | MatrixLookup(const gslapi::matrix&, const std::vector<size_t>&, |
---|
35 | const std::vector<size_t>&); |
---|
36 | |
---|
37 | /// |
---|
38 | /// Constructor taking the column (default) or row index vector |
---|
39 | /// as input. |
---|
40 | /// |
---|
41 | MatrixLookup(const gslapi::matrix&, const std::vector<size_t>&, |
---|
42 | bool row=false); |
---|
43 | |
---|
44 | /// |
---|
45 | /// Copy constructor. |
---|
46 | /// |
---|
47 | MatrixLookup(const MatrixLookup&); |
---|
48 | |
---|
49 | /// |
---|
50 | /// Constructor taking the row index vector and column index vector |
---|
51 | /// as input. |
---|
52 | /// |
---|
53 | MatrixLookup(const MatrixLookup&, const std::vector<size_t>&, |
---|
54 | const std::vector<size_t>&); |
---|
55 | |
---|
56 | /// |
---|
57 | /// Constructor taking the column (default) or row index vector |
---|
58 | /// as input. |
---|
59 | /// |
---|
60 | MatrixLookup(const MatrixLookup&, const std::vector<size_t>&, const bool row=false); |
---|
61 | |
---|
62 | /// |
---|
63 | /// Destructor |
---|
64 | /// |
---|
65 | ~MatrixLookup() {}; |
---|
66 | |
---|
67 | |
---|
68 | inline double operator()(const size_t row, const size_t column) const |
---|
69 | { return (*data_)(row_index_[row], column_index_[column]); } |
---|
70 | |
---|
71 | private: |
---|
72 | const gslapi::matrix* data_; |
---|
73 | }; |
---|
74 | |
---|
75 | }} // of namespace classifier and namespace theplu |
---|
76 | |
---|
77 | #endif |
---|