Skip to content

Commit

Permalink
don't use unary minus on unsigned type
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed Nov 13, 2023
1 parent 7dc18e2 commit 8befdcc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/reorder/mc64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ void shortest_augmenting_path(
std::vector<IndexType>& q_j, ValueType tolerance)
{
constexpr auto inf = std::numeric_limits<ValueType>::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<IndexType>(num_rows);

auto p = permutation.get_data();
auto ip = inv_permutation.get_data();
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8befdcc

Please sign in to comment.