Skip to content

direct numpy conversion and nullspace as matrix#6

Open
andibau13 wants to merge 1 commit into
akissinger:mainfrom
andibau13:add-numpy-and-nullspace-matrix
Open

direct numpy conversion and nullspace as matrix#6
andibau13 wants to merge 1 commit into
akissinger:mainfrom
andibau13:add-numpy-and-nullspace-matrix

Conversation

@andibau13

Copy link
Copy Markdown

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

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