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.
Loading
Please register or sign in to comment