-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix classical control diagram symbols and svg #7233
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7233 +/- ##
=======================================
Coverage 98.65% 98.65%
=======================================
Files 1106 1106
Lines 95869 95882 +13
=======================================
+ Hits 94581 94594 +13
Misses 1288 1288 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I tagged this to be discussed at the next Cirq Cynq. A change like this strikes me as a breaking change. I see in the comments on #5688 this concerns was brought up a couple of years ago, but not resolved at the time. |
Yeah I understand the concern. If it's decided that this is breaking, we should also probably revisit other issues involving presentation of circuit diagrams (e.g. #1245, #3597, #3612, #3913, etc), SVG (#5689), 3D view, Bloch sphere, and so on, and close anything else that would be considered breaking. |
Fixes #5688. Fixes #5689.
A quick image search for circuit diagrams shows that the convention seems to be arrows for measurement, which I represent here in diagrams with
V
. I followed the suggestion from #5688 to use the quantum control symbol@
to represent classical control as well.For SVG, now the circuit from the teleportation example renders in a more standard fashion, with double-lines for classical registers and measurements, and arrows representing classical data flow:

(previously looked like this, which is obviously misleading):

I avoided the suggestion from #5688 to represent measurement as
X
in diagrams. The rationale is thatX
implies a bit flip. However in Cirq, multiple measurements to the same register will be stored independently in an array. So, representing those asX
, which implies a bit flip, would be a misrepresentation.I'll leave it open to discussion on whether this is correct and/or better. It's a three-character change in the source and then a global find-and-replace to patch up the tests and docs, so it's easy to accommodate whatever y'all decide here.