clears uv_mapping and resizes as needed */
| 43 | |
| 44 | /** clears uv_mapping and resizes as needed */ |
| 45 | void create_unique_val_mapping(std::vector<UniqueValElem>& uv_mapping, |
| 46 | const std::vector<double>& v, |
| 47 | const std::vector<bool>& v_undef) |
| 48 | { |
| 49 | uv_mapping.clear(); |
| 50 | int cur_ind = -1; |
| 51 | |
| 52 | for (int i=0, iend=v.size(); i<iend; i++) { |
| 53 | if (v_undef[i]) |
| 54 | continue; |
| 55 | if (uv_mapping.empty()) { |
| 56 | cur_ind++; |
| 57 | uv_mapping.push_back(UniqueValElem(v[i], i, i)); |
| 58 | } else { |
| 59 | if (uv_mapping[cur_ind].val != v[i]) { |
| 60 | uv_mapping[cur_ind].last = i-1; |
| 61 | cur_ind++; |
| 62 | uv_mapping.push_back(UniqueValElem(v[i], i, i)); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /** Assume that b.size() <= N-1 */ |
| 69 | void pick_rand_breaks(std::vector<int>& b, int N, boost::uniform_01<boost::mt19937>& X) |
no test coverage detected