-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement LinearOperator protocol for SparsePauliOp #13490
Comments
Copied from my Slack messages, for further context:
|
FWIW I have an existing workaround for this (private repo) that does not use |
This is one more reason to use a Fwiw, |
When I say "very slow", I mean relative to what we should be able to achieve in Rust. Writing the same thing from Rust would still be approximately as fast as a pure Python-space implementation, maybe even a hair faster because of reduced loop overhead, but we'd still be bottlenecked on accesses to Python objects. |
What should we add?
Doing linear algebra with a SparsePauliOp typically involves converting it to a sparse matrix, which takes a very long time. However, many linear algebra tasks don't require explicit storage of all of the matrix elements, but merely require knowledge of how the operator transforms a vector. SciPy has a protocol to capture this concept called LinearOperator, which is a level of abstraction above sparse matrix. We should implement this for SparsePauliOp. There are at least two possible ways to do this:
_matvec
that defines how the operator acts on a vector.The text was updated successfully, but these errors were encountered: