-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
LieTrotter
does not seem to preserve the gate order even with preserve_order=True
#13770
Comments
I don't have an opinion on which way is more expected, and which way Qiskit should output. I just wanted to add: I can easily see arguments for either interpretation, so we should make very clear in the documentation which it is that we mean. For example:
I think both are reasonable viewpoints a person could hold, so we should be really super clear what we mean in the documentation. |
Agreed, though personally I'd probably think of the first one since I would associate the
From a practical perspective, however, changing the order in the |
Oh yeah, I think both are totally valid. If pressed, I think I'd say that I expect my second option marginally more than my first, which (iiuc) agrees with Qiskit's current behaviour. I've no strong horse in this race (so I've nothing more to say, I think), other than my weak expectation and general desire for stability. I just wanted to comment that whichever way you choose to resolve this, I think we need very very clear documentation about it. |
I agree that changing the current behavior is annoying. It would be good to (1) write a note about the operator order in the documentation and (2) change the draw of As for (2), Qiskit draws the circuit as follows.
That's why I expected |
It's the eternal dilemma of stability vs. changing to what we want it to be 😅 changing is annoying but writing yet another note of "Qiskit does something reversed to what you think it is" is also not very attractive... |
Environment
What is happening?
When I generate
PauliEvolutionGate
ofXI+ZZ
, it corresponds toU(t)=exp(-it (XI+ZZ))
and is approximated asexp(-it XI) exp(-it ZZ)
becauseLieTrotter
withreps=1
andpreserve_order=True
is applied as default.I think a circuit with the gate represents
U(t)|0> = exp(-it XI) exp(-it ZZ) |0>
andZZ
part will be applied earlier thanXI
part.But Qiskit generates RZZ gate first as follows. The reverse order matches the numerically calculated matrix.
Reference: LieTrotter documentation

How can we reproduce the issue?
output
What should happen?
I expect to apply RZZ earlier than RX if
preserve_order=True
Any suggestions?
It might be resolved by reversing the input operator as I did in the script.
The text was updated successfully, but these errors were encountered: