| 17 | } |
| 18 | |
| 19 | MatrixInfo readMatrixInfo( |
| 20 | const ExampleInfo& info, int slot_id, int sizeof_idx, int sizeof_val) { |
| 21 | MatrixInfo f; |
| 22 | int i = 0; |
| 23 | for (; i < info.slot_size(); ++i) if (info.slot(i).id() == slot_id) break; |
| 24 | if (i == info.slot_size()) return f; |
| 25 | |
| 26 | auto slot = info.slot(i); |
| 27 | if (slot.format() == SlotInfo::DENSE) { |
| 28 | f.set_type(MatrixInfo::DENSE); |
| 29 | } else if (slot.format() == SlotInfo::SPARSE) { |
| 30 | f.set_type(MatrixInfo::SPARSE); |
| 31 | } else if (slot.format() == SlotInfo::SPARSE_BINARY) { |
| 32 | f.set_type(MatrixInfo::SPARSE_BINARY); |
| 33 | } |
| 34 | f.set_row_major(true); |
| 35 | f.set_id(slot.id()); |
| 36 | f.mutable_row()->set_begin(0); |
| 37 | f.mutable_row()->set_end(info.num_ex()); |
| 38 | f.mutable_col()->set_begin(slot.min_key()); |
| 39 | f.mutable_col()->set_end(slot.max_key()); |
| 40 | |
| 41 | f.set_nnz(slot.nnz_ele()); |
| 42 | f.set_sizeof_index(sizeof_idx); |
| 43 | f.set_sizeof_value(sizeof_val); |
| 44 | |
| 45 | // LL << info.DebugString() << "\n" << f.DebugString(); |
| 46 | // *f.mutable_ins_info() = info; |
| 47 | return f; |
| 48 | } |
| 49 | |
| 50 | ExampleInfo mergeExampleInfo(const ExampleInfo& A, const ExampleInfo& B) { |
| 51 | std::map<int, SlotInfo> slots; |
no test coverage detected