-
Notifications
You must be signed in to change notification settings - Fork 61
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
Question about SymbolicHamiltonian.circuit
#1357
Comments
I agree there is a bug, because there is a missing copy that links the In particular, the following also works: d = hamiltonians.SymbolicHamiltonian(symbols.Z(0))
a = d.circuit(0.1)
b = d.circuit(0.1)
c = (a+b).unitary()
print(np.linalg.norm(d.circuit(0.2).unitary() - c)) even without the I didn't dig into the code, but it's pretty clear that, for as long as The bug should be definitely investigated and solved. The one above is just a workaround, but should not be used for long. |
Btw, I'm pretty sure the problem to be related to Sympy: the This symbol is the one derived from the original Hamiltonian, and it is not deepcopied, since all the occurrences of the symbol should agree with each other. So, I'm not yet so sure if this is a bug, or a limitation we have to accept for using symbols. @stavros11, we should dedicate some more time to rethink the usage of symbols in general (we don't have to drop them, but we should be careful). @marekgluza, for the time being, whenever you want to be certain about the result, and you don't want it to be intentionally linked through a symbol, keep copying. |
I assume it's a bug because it has cost me 2x a couple of days of work to trouble shoot the following issue appearing deep in the
dbi
module code:Output:
TLDR: If you assign the return value of
SymbolicHamiltonian.circuit
and then want to use theCircuit
instance e.g. for further addition then noise comes out. Correct result can be obtained by running on deepcopies.The text was updated successfully, but these errors were encountered: