Closed Bennybenassius closed 3 weeks ago
Thanks for reporting the problem. I have not tested this for Qiskit 1.2, but in the current development branch the bug manifested as a DAGCircuitError
exception. There was indeed a problem, and I have checked in a fix in #13083. As I have commented in the fix, the code is very messy and I would not be surprised if there were many other bugs as well, please keep reporting these if you find them. The code would probably benefit from a complete rewrite, in addition to porting it to Rust :).
One other small comment: the equality for two Statevectors already takes some tolerance into account, so you can directly check whether sv0 == sv1
instead of computing the dot product of sv0
and sv1
.
Thanks for the response! We'll keep reporting new bugs if we find any. The point you made about statevector comparison has been noted.
Environment
What is happening?
Ilan and I found this issue when testing our circuit with specific transpiler passes:
When passing a specific circuit through the
HoareOptimizer()
, there seems to be a change to the semantics of the circuit.How can we reproduce the issue?
Running the code below will produce 2 state-vectors: one before passing the circuit through
HoareOptimizer()
and one after. They are not the same, and the subsequent circuit print shows that a CX gate was removed where it shouldn't have.The circuit before optimization:
The circuit after:
What should happen?
The circuit should have been optimized in a way that produced the same resulting state-vector.
Might be related to this issue #4981 that was closed.
Any suggestions?
No response