Skip to content
Snippets Groups Projects
Commit c8272a07 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Switch internal data structure in MatrixIndexSet

This replaces the `std::set` used to store the column indices for each
rows by a `std::vector` based implementation. The `std::vector` is
kept sorted when inserting such that we can avoid duplicates. This
can improve assembly time of matrices significantly (if `MatrixIndexSet` is used).

In the worst case (insertion in reverse) this may lead to O(n^2) complexity
when inserting n entries in a row compared to O(n log(n)) for `std::set`.
However, the sorted `std::vector` implementation still wins for relatively
large n. To avoid the worst case complexity when using very dense rows,
the implementation is switched to `std::set` if the size exceeds the threshold
value `maxVectorSize`. The default `maxVectorSize=2048` was selected based
on benchmark results.
parent 1623ad6e
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment