-
Notifications
You must be signed in to change notification settings - Fork 54
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
Library hard crashing when computing BBFG permanent with a 0x0 matrix #319
Comments
Hi @GregoryMorse --- Could you tell us which version of thewalrus are you using? |
Hi @nquesada, version 0.16.1, the one in PyPi |
Thanks for bringing this to our attention @GregoryMorse. As of the latest release (v0.18.0), The Walrus no longer uses The equivalent code to your example above would be: import numpy as np
import thewalrus as tw
mat = np.zeros((0, 0))+np.zeros((0, 0)) * 1j
tw.perm(mat, method="bbfg") With that said, it seems like this function has the same issue, so a fix would still be needed to make sure that the permanent function returns 1 for an empty matrix. We will look into fixing this in an upcoming release! |
or, alternatively, @GregoryMorse , you are most welcome to do a PR fixing it and become a contributor! You can use the example of how this is solved in the thewalrus/thewalrus/_hafnian.py Line 770 in 4452c64
|
Fix issue XanaduAI#319 by checking 0 size matrices and returning one in permanent computations
* Fix size-0 matrix permanents Fix issue #319 by checking 0 size matrices and returning one in permanent computations * Update test_permanent.py * Update test_permanent.py remove unnecessary whitespace * Update _permanent.py Fixed formatting * Update test_permanent.py * Update ACKNOWLEDGMENTS.md * Update CHANGELOG.md * Update _permanent.py * Update .github/CHANGELOG.md * Update .github/CHANGELOG.md Co-authored-by: Theodor <theodor.isacsson@gmail.com>
Before posting a bug report
Expected behavior
Returning one (1+0j)
Actual behavior
Native code hard crashing Python in Windows/Linux with "overflow to inf" output
Reproduces how often
Always
System information
Source code
Tracebacks
Additional information
Probably the real number case has the same bug. perm_complex returns 0 instead of 1+0j so it is also bugged. None of the 0x0 dimension permanents are working correctly.
The text was updated successfully, but these errors were encountered: