quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Break intermediate measurements on 3+ qubits into single qubit measurements in `RouteCQC`#6293 #6349

Closed shef4 closed 11 months ago

shef4 commented 1 year ago

router mishandling mid-circuit measurements #issue6293

Description of the issue

cirq.RouteCQC commutes gates in undefined ways due to intermediate measurements with 3 or more qubits not being handled correctly.

This PR aims to fix this issue by:

Breaking intermediate measurements on 3+ qubits into single qubit measurements if the result isn't stored (i.e. key is None) else a ValueError is raised.

Next Steps

Check if it's possible to create a ClassicallyControlledOperation controlled by the result of a multiqubit measurement

cirq.ClassicallyControlledOperation(
    sub_operation: 'cirq.Operation',
    conditions: Sequence[Union[str, 'cirq.MeasurementKey', 'cirq.Condition', sympy.Basic]]
)

From looking at the documentation it seems to be possible. Will stop here until there is a need to support this case.

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov[bot] commented 1 year ago

Codecov Report

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

Comparison is base (b5b3b74) 97.84% compared to head (93a06f6) 97.84%. Report is 1 commits behind head on master.

:exclamation: Current head 93a06f6 differs from pull request most recent head 7a03d0c. Consider uploading reports for the commit 7a03d0c to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6349 +/- ## ======================================= Coverage 97.84% 97.84% ======================================= Files 1110 1110 Lines 96690 96706 +16 ======================================= + Hits 94606 94622 +16 Misses 2084 2084 ```

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