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
StatevectorSampler is not supposed to support midcircuit measurements. However, in its current implementation, there are instances where instead of throwing an error, it produces the wrong result.
Notice that the expected output is ~ 50% 00 - 50% 11, but sampler returns ~ 50% 01 - 50% 11.
What should happen?
StatevectorSampler should throw an error because the measurement result in c_1 is being used to control an XGate, but instead it is ignoring the control and always applying the gate independent on the value on c_1, producing incorrect results.
Any suggestions?
Haven't spent much time looking at the code, but it seems that the issue stems from StatevectorSampler only checking if there are repeated measurement blocks on the same qubit. In this example, there's only one measurement per qubit, so both get removed as if they were "final measurements". The circuit then executes without error, but obviously produces incorrect results because it is treating c_1 as always being equal to 0.
Not sure what the right solution would be at this point, but probably checking for dynamic-circuit conditionals?
The text was updated successfully, but these errors were encountered:
Environment
What is happening?
StatevectorSampler
is not supposed to support midcircuit measurements. However, in its current implementation, there are instances where instead of throwing an error, it produces the wrong result.How can we reproduce the issue?
Example:
Output:
Notice that the expected output is ~ 50%
00
- 50%11
, but sampler returns ~ 50%01
- 50%11
.What should happen?
StatevectorSampler
should throw an error because the measurement result inc_1
is being used to control anXGate
, but instead it is ignoring the control and always applying the gate independent on the value onc_1
, producing incorrect results.Any suggestions?
Haven't spent much time looking at the code, but it seems that the issue stems from
StatevectorSampler
only checking if there are repeated measurement blocks on the same qubit. In this example, there's only one measurement per qubit, so both get removed as if they were "final measurements". The circuit then executes without error, but obviously produces incorrect results because it is treatingc_1
as always being equal to0
.Not sure what the right solution would be at this point, but probably checking for dynamic-circuit conditionals?
The text was updated successfully, but these errors were encountered: