-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support sparse matrices in cast methods #68
Conversation
Codecov Report
@@ Coverage Diff @@
## main #68 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 1022 1080 +58
=========================================
+ Hits 1022 1080 +58
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I extended the linear algebra methods for eigenvectors to work with sparse matrices, however it seems that these methods are a bit unstable, particularly for cupy. For example the following script: from qibo import hamiltonians
from cupy import sparse
from cupy.sparse.linalg import eigsh
h = hamiltonians.TFIM(4, h=1.0)
m = sparse.coo_matrix(h.matrix)
for _ in range(10):
eigvals, eigvecs = eigsh(m, 6)
print(eigvals) gives different values for the eigenvalues of the same matrix in each iteration. This makes testing a bit hard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me.
Required to enable qibo Hamiltonian creation using sparse matrices. Sparse matrices are supported for both numba (via
scipy.sparse
) and cupy/cuquantum (viacupy.sparse
) platforms.