Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support drawing MidMeasureMP with qml.draw #4775

Merged
merged 9 commits into from
Nov 8, 2023
Merged

Support drawing MidMeasureMP with qml.draw #4775

merged 9 commits into from
Nov 8, 2023

Conversation

mudit2812
Copy link
Contributor

Context:
Mid-circuit measurements cannot be drawn with qml.draw. This is the first PR to support drawing mid-circuit measurements

Description of the Change:

  • Added label to MidMeasureMP, including cases of qubit reset and postselection.
  • Minor changes to qml.drawer.tape_text to support drawing measurements in the ops queue. Measurements without a defined label method (which is all measurements except MidMeasureMP`) will still break the drawer, which is what we want.

Benefits:
We can now draw mid-circuit measurements! qml.cond is still not supported. That will come in future PRs

Possible Drawbacks:

Related GitHub Issues:

Copy link

codecov bot commented Nov 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2c7c0c1) 99.64% compared to head (0b8d39c) 99.63%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4775      +/-   ##
==========================================
- Coverage   99.64%   99.63%   -0.01%     
==========================================
  Files         381      381              
  Lines       34324    34074     -250     
==========================================
- Hits        34202    33951     -251     
- Misses        122      123       +1     
Files Coverage Δ
pennylane/drawer/utils.py 100.00% <100.00%> (ø)
pennylane/measurements/mid_measure.py 100.00% <100.00%> (ø)
pennylane/operation.py 97.26% <100.00%> (ø)

... and 42 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mudit2812 mudit2812 marked this pull request as ready for review November 3, 2023 18:09
@mudit2812 mudit2812 requested review from trbromley and a team November 3, 2023 18:10
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍

@mudit2812 mudit2812 requested a review from timmysilv November 6, 2023 15:48
@mudit2812 mudit2812 requested review from timmysilv and removed request for timmysilv November 8, 2023 15:22
@trbromley
Copy link
Contributor

@mudit2812 please could you link the SC story

Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel quite strongly that we're treading in dangerous waters now... but I don't want to block this PR any further. looks good to me! :shipit:

@mudit2812
Copy link
Contributor Author

[sc-49111]

@mudit2812 mudit2812 enabled auto-merge (squash) November 8, 2023 16:33
@mudit2812 mudit2812 merged commit 4eecda9 into master Nov 8, 2023
@mudit2812 mudit2812 deleted the draw-mcm-1 branch November 8, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants