From 8befdcc0bf157ff463db0fef60e85b897957900f Mon Sep 17 00:00:00 2001 From: Marcel Koch Date: Mon, 13 Nov 2023 08:55:17 +0100 Subject: [PATCH] don't use unary minus on unsigned type --- core/reorder/mc64.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/reorder/mc64.cpp b/core/reorder/mc64.cpp index b9b8daf382e..e27fbf2a006 100644 --- a/core/reorder/mc64.cpp +++ b/core/reorder/mc64.cpp @@ -211,10 +211,10 @@ void shortest_augmenting_path( std::vector& q_j, ValueType tolerance) { constexpr auto inf = std::numeric_limits::infinity(); - const auto nnz = row_ptrs[num_rows]; auto weights = weights_array.get_data(); auto dual_u = dual_u_array.get_data(); auto distance = distance_array.get_data(); + auto num_rows_s = static_cast(num_rows); auto p = permutation.get_data(); auto ip = inv_permutation.get_data(); @@ -277,7 +277,7 @@ void shortest_augmenting_path( } else { distance[col] = dnew; parents[col] = row; - generation[col] = num_rows + root; + generation[col] = num_rows_s + root; if (dnew < lsp) { lsp = dnew; } @@ -292,9 +292,9 @@ void shortest_augmenting_path( const auto col = col_idxs[idx]; const auto dist = distance[col]; const auto gen = generation[col]; - if (dist < lsap && gen == num_rows + root) { + if (dist < lsap && gen == num_rows_s + root) { if (abs(dist - lsp) < tolerance) { - generation[col] = -num_rows - root; + generation[col] = -num_rows_s - root; q_j.push_back(col); } else { generation[col] = root; @@ -369,14 +369,14 @@ void shortest_augmenting_path( parents[col] = row; } else { if ((gen != root || dnew < distance[col]) && - gen != -num_rows - root) { + gen != -num_rows_s - root) { distance[col] = dnew; parents[col] = row; if (abs(dnew - lsp) < tolerance) { // dnew is the shortest currently possible distance, // so col can be put into q_j and be marked // accordingly. - generation[col] = -num_rows - root; + generation[col] = -num_rows_s - root; q_j.push_back(col); } else if (gen != root) { // col was not encountered before.