1 | // $Id$ |
---|
2 | |
---|
3 | #include <c++_tools/classifier/DataLookup2D.h> |
---|
4 | |
---|
5 | #include <vector> |
---|
6 | |
---|
7 | namespace theplu { |
---|
8 | namespace classifier { |
---|
9 | |
---|
10 | |
---|
11 | DataLookup2D::DataLookup2D() |
---|
12 | { |
---|
13 | } |
---|
14 | |
---|
15 | |
---|
16 | DataLookup2D::DataLookup2D(const DataLookup2D& m, |
---|
17 | const std::vector<size_t>& row, |
---|
18 | const std::vector<size_t>& col) |
---|
19 | { |
---|
20 | assert(row_index_.empty()); |
---|
21 | row_index_.reserve(row.size()); |
---|
22 | for (size_t i=0; i<row.size(); i++) |
---|
23 | row_index_.push_back(m.row_index_[row[i]]); |
---|
24 | assert(column_index_.empty()); |
---|
25 | column_index_.reserve(col.size()); |
---|
26 | for (size_t i=0; i<col.size(); i++) |
---|
27 | column_index_.push_back(m.column_index_[col[i]]); |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | DataLookup2D::DataLookup2D(const DataLookup2D& m, |
---|
33 | const std::vector<size_t>& index, |
---|
34 | const bool row) |
---|
35 | { |
---|
36 | if (row){ |
---|
37 | assert(row_index_.empty()); |
---|
38 | row_index_.reserve(index.size()); |
---|
39 | for (size_t i=0; i<index.size(); i++) |
---|
40 | row_index_.push_back(m.row_index_[index[i]]); |
---|
41 | column_index_= m.column_index_; |
---|
42 | } |
---|
43 | else{ |
---|
44 | assert(column_index_.empty()); |
---|
45 | column_index_.reserve(index.size()); |
---|
46 | for (size_t i=0; i<index.size(); i++) |
---|
47 | column_index_.push_back(m.row_index_[index[i]]); |
---|
48 | row_index_= m.row_index_; |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | DataLookup2D::DataLookup2D(const std::vector<size_t>& row, |
---|
54 | const std::vector<size_t>& col) |
---|
55 | : row_index_(row),column_index_(col) |
---|
56 | { |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | DataLookup2D::DataLookup2D(const std::vector<size_t>& index, bool row) |
---|
62 | { |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | DataLookup2D::DataLookup2D(const DataLookup2D& mv) |
---|
67 | : row_index_(mv.row_index_),column_index_(mv.column_index_) |
---|
68 | { |
---|
69 | } |
---|
70 | |
---|
71 | |
---|
72 | }} // of namespace classifier and namespace theplu |
---|