From 1e2cb79628a85cd7c90825e8da63ff031b4684d9 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 4 Oct 2024 18:34:01 +0200 Subject: [PATCH] Fix with better performance --- source/lac/sparsity_tools.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index d1e0aaa9fa..83671e16eb 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -824,7 +824,9 @@ namespace SparsityTools ++write_index; if (n_remaining_neighbors[node] < candidate_valence || (n_remaining_neighbors[node] == candidate_valence && - row_lengths[node] > candidate_row_length)) + (row_lengths[node] > candidate_row_length || + (row_lengths[node] == candidate_row_length && + node < candidate_index)))) { candidate_index = node; candidate_valence = n_remaining_neighbors[node]; @@ -878,7 +880,6 @@ namespace SparsityTools n_remaining_neighbors[it->column()]--; } } - std::sort(current_neighbors.begin(), current_neighbors.end()); } } -- 2.39.5