-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cannot add identity to PauliSum #4087
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
Comments
In lieu of a fix, users can wrap identity gates in
|
Another shorter workaround is
but I was also wondering if |
problem: the PauliSum add function checks that the type of the other operand is one of numbers.Complex, PauliString, PauliSum and raises NotImplemented otherwise. fix: if the other operand is not one of the types try to cast it to PauliString and raise error only if that fails
… a PauliSum is a valid operation
The This gives us another workaround for the issue: ps = cirq.PauliSum()
ps += 1 which actually works fine at the moment. I think that the above code snippet and ps = cirq.PauliSum()
ps += cirq.I(cirq.LineQubit(0)) should have the same effect once the issue is fixed. |
Problem: the PauliSum add function checks that the type of the other operand is one of numbers.Complex, PauliString, PauliSum and raises NotImplemented otherwise. Fix: if the other operand is not one of the types try to cast it to PauliString and raise error only if that fails Fixes #4087.
Problem: the PauliSum add function checks that the type of the other operand is one of numbers.Complex, PauliString, PauliSum and raises NotImplemented otherwise. Fix: if the other operand is not one of the types try to cast it to PauliString and raise error only if that fails Fixes quantumlib#4087.
Problem: the PauliSum add function checks that the type of the other operand is one of numbers.Complex, PauliString, PauliSum and raises NotImplemented otherwise. Fix: if the other operand is not one of the types try to cast it to PauliString and raise error only if that fails Fixes quantumlib#4087.
Description of the issue
Identities cannot be added to PauliSums. This might be related to
cirq.IdentityGate
not being acirq.Pauli
.How to reproduce the issue
Cirq version
0.11.0.dev
The text was updated successfully, but these errors were encountered: