Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condense sparsity pattern: don't check if entries already exist #550

Merged
merged 1 commit into from
Dec 11, 2022

Conversation

fredrikekre
Copy link
Member

After #436 the condensation of the pattern is done by creating a new matrix which is added to the original matrix. Before this patch there is still a check for whether each new entry already exist in the original matrix before adding it to the new matrix. With the new approach implemented in #436 this seems unnecessary and this patch removes the check. This also removes some extra complexity from the code.

A datapoint, which support this, is the Stoke's flow example in the documentation. In that problem, the condensation adds 32k new entries, of which 30k are new, and 2k exist in the original matrix. Checking whether the 32k elements exist is much more expensive than simply including the extra 2k entries in the new matrix. The new approach reduces the time for creating the combined matrix from 4ms to 3.2ms.

Matrix creation isn't a bottleneck by any means, but it is nice to see that we with simpler code also get better performance.

After #436 the condensation of the pattern is done by creating a new
matrix which is added to the original matrix. Before this patch there is
still a check for whether each new entry already exist in the original
matrix before adding it to the new matrix. With the new approach
implemented in #436 this seems unnecessary and this patch removes the
check. This also removes some extra complexity from the code.

A datapoint, which support this, is the Stoke's flow example in the
documentation. In that problem, the condensation adds 32k new entries,
of which 30k are new, and 2k exist in the original matrix. Checking
whether the 32k elements exist is much more expensive than simply
including the extra 2k entries in the new matrix. The new approach
reduces the time for creating the combined matrix from 4ms to 3.2ms.

Matrix creation isn't a bottleneck by any means, but it is nice to see
that we with simpler code also get better performance.
@fredrikekre fredrikekre merged commit cb8b8e5 into master Dec 11, 2022
@fredrikekre fredrikekre deleted the fe/cond branch December 11, 2022 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant