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 quantum circuit in file groverFuncs.py is transpiled and then gets the measurement gate added to it.
Unfortunately, the transpilation is done with the optimization_level=3 option, which means that the measurements plays an important role in the optimization.
For example, OptimizeSwapBeforeMeasure is a pass that removes the swap gates before the measurement, leading to a non-equivalent circuit (See the doc regarding this level 3: here).
How can we reproduce the issue?
If you run this code, you can see whether the result is affected by the mistake of adding the measurement after the transpilation.
Hi!
It has been a while since I've work on this code, but I will look into this once i've got some free time.
I might just end up recreating this notebook in the qwak project, but i'll mention this git issue if i do.
Environment
What is happening?
The quantum circuit in file groverFuncs.py is transpiled and then gets the measurement gate added to it.
Unfortunately, the transpilation is done with the
optimization_level=3
option, which means that the measurements plays an important role in the optimization.For example,
OptimizeSwapBeforeMeasure
is a pass that removes the swap gates before the measurement, leading to a non-equivalent circuit (See the doc regarding this level 3: here).How can we reproduce the issue?
If you run this code, you can see whether the result is affected by the mistake of adding the measurement after the transpilation.
Output:
In this case, luckily the optimization did not affected the result, but it might have happened.
What should happen?
I would have expected the version with transpilation as last step, since it is more robust.
Any suggestions?
I would recommend to move the measurement before the transpilation. Following the recommendation of Qiskit developers. See here
The text was updated successfully, but these errors were encountered: