Skip to content

Commit 847149a

Browse files
author
jajhall
committed
No longer using index_set in assessMatrix; removed minor debugging code
1 parent 8053eb7 commit 847149a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

highs/util/HighsMatrixUtils.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ HighsStatus assessMatrix(
144144
double min_large_value = kHighsInf;
145145
HighsInt num_duplicate = 0;
146146
// Use index_map to identify duplicates.
147-
HighsHashTable<HighsInt> index_set;
147+
// HighsHashTable<HighsInt> index_set;
148148
std::vector<HighsInt> el_in_vec;
149149
const HighsInt illegal_el = -1;
150150
el_in_vec.assign(vec_dim, illegal_el);
@@ -154,7 +154,6 @@ HighsStatus assessMatrix(
154154
HighsInt to_el = matrix_start[ix + 1];
155155
// Account for any index-value pairs removed so far
156156
matrix_start[ix] = num_new_nz;
157-
HighsInt debug_num_duplicate = 0;
158157
HighsInt vec_original_num_nz = to_el - from_el;
159158
for (HighsInt el = from_el; el < to_el; el++) {
160159
// Check the index
@@ -182,9 +181,11 @@ HighsStatus assessMatrix(
182181
return HighsStatus::kError;
183182
}
184183
// Check that the index has not already occurred.
185-
legal_component = index_set.find(component) == nullptr;
186184
HighsInt previous_el = el_in_vec[component];
187185
bool is_duplicate = previous_el > illegal_el;
186+
// 2821 eliminates need for index_set
187+
/*
188+
legal_component = index_set.find(component) == nullptr;
188189
if (legal_component != !is_duplicate) {
189190
printf(
190191
"assessMatrix: ix = %d; el_in_vec[%d/%d] = %d; legal_component = "
@@ -193,10 +194,10 @@ HighsStatus assessMatrix(
193194
legal_component);
194195
}
195196
assert(legal_component == !is_duplicate);
197+
*/
196198
if (is_duplicate) {
197199
if (sum_duplicates) {
198200
num_duplicate++;
199-
debug_num_duplicate++;
200201
// Sum the duplicate entry
201202
assert(matrix_index[previous_el] == component);
202203
matrix_value[previous_el] += matrix_value[el];
@@ -216,13 +217,12 @@ HighsStatus assessMatrix(
216217
matrix_index[num_new_nz] = matrix_index[el];
217218
matrix_value[num_new_nz] = matrix_value[el];
218219
// Record where the index has occurred
219-
index_set.insert(component);
220+
// index_set.insert(component);
220221
el_in_vec[component] = num_new_nz;
221222
num_new_nz++;
222223
}
223224
from_el = matrix_start[ix];
224225
to_el = num_new_nz;
225-
assert(to_el - from_el == vec_original_num_nz - debug_num_duplicate);
226226
// Reset num_new_nz
227227
num_new_nz = matrix_start[ix];
228228
// Reset el_in_vec
@@ -266,16 +266,16 @@ HighsStatus assessMatrix(
266266
// the new number of nonzeros
267267
matrix_index[num_new_nz] = matrix_index[el];
268268
matrix_value[num_new_nz] = matrix_value[el];
269-
/*
269+
/*
270270
if (expensive_2821_check) {
271271
// Record where the index has occurred
272272
el_in_vec[component] = num_new_nz;
273273
}
274-
*/
274+
*/
275275
num_new_nz++;
276276
}
277277
} // Loop from_el; to_el
278-
index_set.clear();
278+
// index_set.clear();
279279
/*
280280
if (expensive_2821_check) {
281281
// Reset el_in_vec

0 commit comments

Comments
 (0)