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