-
Notifications
You must be signed in to change notification settings - Fork 79
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
Allow sparse matrix as circuit input #197
Comments
It is not only a type conversion. If you keep the input density matrix in sparse matrix form, how to deal with gate application in the language of tensor network in implementation level? It requires heavy code refactoring if possible. An alternative is to use |
OK, I can understand the difficulty.
Notice that sparse matrices for observable expectations are already implemented. I am wondering whether we can do a similar thing for input states. Because input states and observables seem to be dual to each other in my understanding. |
A very interesting point! Of course the input state and the observable are dual where you can simulate the same quantity by specifying the observable as the input state in Essentially, the observable expectation for sparse matrix is only valid for pure state simulator as well. |
Issue Description
In some cases, we would like a sparse matrix as circuit input.
Right now, this seems impossible because of type conversion. For example, DMCircuit does this:
which throws an error like "TypeError: Failed to convert elements of SparseTensor(...) to Tensor" in TensorFlow.
Proposed Solution
I'm not sure whether we can just modify type conversions.
The text was updated successfully, but these errors were encountered: