removes the row with the given index from the matrix, afterwards the index can be reused for new rows
| 145 | /// removes the row with the given index from the matrix, afterwards the index |
| 146 | /// can be reused for new rows |
| 147 | void HighsDynamicRowMatrix::removeRow(HighsInt rowindex) { |
| 148 | HighsInt start = ARrange_[rowindex].first; |
| 149 | HighsInt end = ARrange_[rowindex].second; |
| 150 | |
| 151 | if (colsLinked[rowindex]) { |
| 152 | for (HighsInt i = start; i != end; ++i) { |
| 153 | HighsInt col = ARindex_[i]; |
| 154 | |
| 155 | if (ARvalue_[i] > 0) { |
| 156 | HighsInt prev = AprevPos_[i]; |
| 157 | HighsInt next = AnextPos_[i]; |
| 158 | |
| 159 | if (next != -1) { |
| 160 | assert(AprevPos_[next] == i); |
| 161 | AprevPos_[next] = prev; |
| 162 | } |
| 163 | |
| 164 | if (prev != -1) { |
| 165 | assert(AnextPos_[prev] == i); |
| 166 | AnextPos_[prev] = next; |
| 167 | } else { |
| 168 | assert(AheadPos_[col] == i); |
| 169 | AheadPos_[col] = next; |
| 170 | } |
| 171 | } else { |
| 172 | HighsInt prev = AprevNeg_[i]; |
| 173 | HighsInt next = AnextNeg_[i]; |
| 174 | |
| 175 | if (next != -1) { |
| 176 | assert(AprevNeg_[next] == i); |
| 177 | AprevNeg_[next] = prev; |
| 178 | } |
| 179 | |
| 180 | if (prev != -1) { |
| 181 | assert(AnextNeg_[prev] == i); |
| 182 | AnextNeg_[prev] = next; |
| 183 | } else { |
| 184 | assert(AheadNeg_[col] == i); |
| 185 | AheadNeg_[col] = next; |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | // register the space of the deleted row and the index so that it can be |
| 192 | // reused |
| 193 | deletedrows_.push_back(rowindex); |
| 194 | freespaces_.emplace(end - start, start); |
| 195 | |
| 196 | // set the range to -1,-1 to indicate a deleted row |
| 197 | ARrange_[rowindex].first = -1; |
| 198 | ARrange_[rowindex].second = -1; |
| 199 | } |
no test coverage detected