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.
The is currently a large allocation from calling
Matrix
on the rhs array before/
This PR reduces memory use of solve by running the problem column-by-column using
solve!
more directly.It also allows passing in
Z
andlu
objects for re-use. This is less useful than it sounds currently, as they will usually change size tile-by-tile when we are running it multiple times. Likely we need to move to requiring julia 1.11 where we can reuse array memory more easily. I'm not sure how easy that is.There is another possible operation following from this one that recognizes that the column vector passed to
solve!
is always "one-hot" vector as the sparse array is essentially a diagonal of ones. Rewriting the suitesparse solver in julia to take advantage of this should be at least a 2x speedup, but maybe more, as there is a lot of looping over reading the whole B vector (in the suitesparse C) when we can just assign 1 once.