-
Notifications
You must be signed in to change notification settings - Fork 251
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
Use entries + stride instead of entries + array of row pointers in matrix types #2162
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@vneiger might want to review this |
25 tasks
I don't think there are any major drawbacks, so I will merge as is; followup tasks already noted in #2165. |
This was referenced Jan 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per #2064.
In general, this should improve performance by making window matrices and temporary matrices cheaper to create (0 and 1 mallocs instead of 1 and 2 respectively). Also opens up for future optimizations where we can exploit the regular offset between rows.
I haven't benchmarked this carefully to make absolutely sure there are no major performance regressions, but here at least is the time for
nmod_mat_solve
to solveAx=b
over a 60-bit prime field:Breaks compatibility with user code that accesses
mat->rows
directly. @albinahlback Nemo needs to be fixed as it uses matrix internals in a few places.An important semantic difference is that row swaps applied to a window matrix now update the contents in the original matrix. In general, this should make life easier.
We did previously rely on being able to create permutation window matrices in
can_solve
/solve
methods. These have been replaced with full temporary matrices, so memory usage may be higher in some cases. There could be workarounds.I didn't bother changing
mpfr_mat
,mpf_mat
,d_mat
andbool_mat
in this PR since those types are for internal use. We may want to retain a version ofd_mat
with the rows pointer anyway since it is used in LLL which does a lot of row swaps (needs profiling).I found a lot of dirt under the carpet while working on this, which I will probably put in a separate issue.