direct numpy conversion and nullspace as matrix#6
Open
andibau13 wants to merge 1 commit into
Open
Conversation
…eturns nullspace directly as matrix
This file contains hidden or 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
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.
Hi Alex,
Thanks a lot for creating this tool, it's been very useful for a project related to transversal logic gates! I (or rather Copilot) made two small modifications for my purposes. Wondering if some of this also might be useful to others so I'm sending this pull request - feel free to ignore of course.
(1) I added direct conversion from numpy matrices to bitmatrices. I'm creating the matrices making heavy use of numpy's powerful indexing/slicing methods which BitMatrix doesn't implement, and only performing RREF using your code. Converting very large numpy matrices to BitMatrix via pure-python lists is extremely slow.
(2) I've added a wrapper that returns the nullspace as a matrix, not as a list. More natural for my purposes and it allows me to directly convert to numpy with change (1).
(3) This is not a change, but a small bug I noticed: The kernel of a 0 x n matrix is all n-dimensional space, not empty. Right now, the code returns the empty list. I didn't fix this in the repo but patched it in my python code. I'm wondering if the code would still run without the first equality in the check
'''if self.rows() == 0 || self.cols() == 0 {
return Vec::new();
}
'''
which would fix it.
Best,
Andi