Skip to content

Commit

Permalink
some additional inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
superwhiskers committed Jul 15, 2024
1 parent 553592f commit 9101b7b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions resolve/matrix/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ namespace ReSolve
// indices swapped.

for (index_type i = 0; i < nnz_with_duplicates; i++) {
// this points to the first element not less than `coo_columns[i]`. see
// https://en.cppreference.com/w/cpp/algorithm/lower_bound for more details
index_type* closest_position =
std::lower_bound(&csr_columns[csr_rows[coo_rows[i]]],
&csr_columns[csr_rows[coo_rows[i]] + used[coo_rows[i]]],
coo_columns[i]);

// this is the offset at which the element's value belongs
index_type insertion_offset = static_cast<index_type>(closest_position - csr_columns);

if (csr_columns[insertion_offset] == coo_columns[i]) {
Expand Down

0 comments on commit 9101b7b

Please sign in to comment.