You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The true problem here is that cutoff tolerances are handled differently in different parts of Qiskit. For example, also on 1.2.4 a small enough angle will remove the CX gates (and the RY):
┌───┐
q_0: ┤ H ├──■─────────────────■──
└───┘┌─┴─┐┌───────────┐┌─┴─┐
q_1: ─────┤ X ├┤ Ry(2e-08) ├┤ X ├
└───┘└───────────┘└───┘
globalphase: 0
┌──────────────┐
q_0: ┤ U3(π/2,0,-π) ├
└──────────────┘
q_1: ────────────────
but this seems to match the tolerance in Operator.equiv, since this prints
equivalent? True
We need to ensure that our processes use the same tolerance algorithm. I'm thinking of CommutationAnalysis/Checker, UnitarySynthesis, RemoveIdentityEquivalent and Operator.equiv, but maybe there are also others. From offline discussions, doing what UnitarySynthesis and RemoveIdentityEquivalent do seems to be the best-motivated choice: consider a gate as the identity, if the process fidelity is below machine epsilon.
Thank you for investigating this issue. The transpilation behavior change between 1.2.4 and 1.3.0 breaks our client code.
Could you suggest me how to configure transpiler to behave in the same way as 1.2.4?
Unfortunately there's currently no way to directly adjust the threshold below which the commutation checker assumes anything commutes with a rotation Ry(epsilon). There's two suboptimal workarounds:
you could either increase the tolerance in Operator.equiv, or
if you directly set the angle to 1e-6 (or whatever the angle is) you could first build the circuit with parameters in the Ry, then transpile, and then bind the values. The commutation checker will then not assume that things commute.
We're working on a fix but I don't think it will make it for 1.3.1, which is scheduled tomorrow.
Environment
What is happening?
Transpilation with optimization level 2 and 3 results in a incorrect circuit for circuits with RY gate with a small angle.
Note that the following code does not have issue with 1.2.4.
How can we reproduce the issue?
What should happen?
The transpiled circuit should be same as the input circuit as 1.2.4 does.
Another example
The following example fails with 1.2.4, 1.3.0, and main branch probably due to a similar reason.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: