dwavesystems / dwave-gate

dwave-gate is a software package for constructing, modifying and running quantum circuits on the provided state-vector simulator.
Apache License 2.0
12 stars 7 forks source link

Fix conditional not propagating with parametric ops #47

Closed thisac closed 5 months ago

thisac commented 5 months ago

When using conditional ops (used for mid-circuit measurements) parametric gates were replaced with copies when evaluated when appended to the active circuit. This caused the conditional modifier not to stick since it was only applied to the original instance and not the copy in the circuit (discovered as a side effect in #46).

with circuit.context as (q, c):
    ...
    RX(np.pi, q[0]).conditional(c[0])
    ...

should result in circuit.circuit being

[..., <ParametricOperation: RX([3.141592653589793]), qubits=(<qubit: '0', id: q03k>,), conditional: (<bit: '0', id: q04j, value: 0>,)>, ...]
codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (a8cc8a3) 100.00% compared to head (7584e6d) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #47 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 17 17 Lines 1563 1563 Branches 263 263 ========================================= Hits 1563 1563 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.