Skip to content

Allow repeated measurements in deferred transformer#5857

Merged
tanujkhattar merged 48 commits intoquantumlib:masterfrom
daxfohl:deferred-repeated
Dec 19, 2022
Merged

Allow repeated measurements in deferred transformer#5857
tanujkhattar merged 48 commits intoquantumlib:masterfrom
daxfohl:deferred-repeated

Conversation

@daxfohl
Copy link
Copy Markdown
Collaborator

@daxfohl daxfohl commented Sep 4, 2022

Fixes the deferred measurements transformer in the presence of repeated measurements on the same measurement key by maintaining all those measurements as a list and controlling against the correct qubits per the control index.

This change will update diagrams of the output circuits slightly. The ancilla qubits now have indexes to represent the order of the measurement for that key.

Closes #5884

@CirqBot CirqBot added the size: M 50< lines changed <250 label Sep 4, 2022
@daxfohl daxfohl marked this pull request as ready for review September 5, 2022 19:57
@daxfohl daxfohl requested review from a team, cduck and vtomole as code owners September 5, 2022 19:57
@daxfohl daxfohl requested a review from dabacon September 5, 2022 19:57
@tanujkhattar
Copy link
Copy Markdown
Collaborator

@daxfohl Please resolve the conflicts and I'll be happy to review this PR as well.

@daxfohl daxfohl marked this pull request as draft November 4, 2022 02:44
@daxfohl
Copy link
Copy Markdown
Collaborator Author

daxfohl commented Nov 4, 2022

Converting to draft to clean up some merge artifacts

@daxfohl daxfohl marked this pull request as ready for review November 4, 2022 05:21
@daxfohl
Copy link
Copy Markdown
Collaborator Author

daxfohl commented Nov 14, 2022

@tanujkhattar ready

@daxfohl
Copy link
Copy Markdown
Collaborator Author

daxfohl commented Dec 16, 2022

@tanujkhattar ready

@tanujkhattar tanujkhattar added the ANNOUNCE CHANGE For pull requests that are not breaking, but still important to mention in release notes. label Dec 19, 2022
Comment thread cirq-core/cirq/transformers/measurement_transformers_test.py
@tanujkhattar tanujkhattar added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Dec 19, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Dec 19, 2022
@tanujkhattar tanujkhattar merged commit af1267d into quantumlib:master Dec 19, 2022
@CirqBot
Copy link
Copy Markdown
Contributor

CirqBot commented Dec 19, 2022

Automerge cancelled: Pull Request is not mergeable.

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Dec 19, 2022
@daxfohl daxfohl deleted the deferred-repeated branch January 6, 2023 02:50
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
* Add handling for sympy conditions in deferred measurement transformer

* docstring

* mypy

* mypy

* cover

* Make this more generic, covers all kinds of conditions.

* Better docs

* Sympy can also be CX

* docs

* docs

* Allow repeated measurements in deferred transformer

* Coverage

* Add mixed tests, simplify loop, add simplification in ControlledGate

* Fix error message

* Simplify error message

* Inline variable

* fix merge

* qudit sympy test

* fix build

* Fix test

* Fix test

* nits

* mypy

* mypy

* mypy

* Add some code comments

* Add test for repeated measurement diagram

* change test back

Co-authored-by: Tanuj Khattar <tanujkhattar@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ANNOUNCE CHANGE For pull requests that are not breaking, but still important to mention in release notes. size: M 50< lines changed <250

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deferred measurements transformer missing some cases

3 participants