-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Text drawer extended for drawing circuits with single classical bit conditioning #6261
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
Conversation
…iskit-terra into issue1160text
Ok it's good that it isn't a bug in |
If I am understanding correct, should we change the value of |
yep @TharrmashasthaPV that's correct! @1ucian0 any thoughts about using |
In other tests we do the same. I think is good for now. At same point probably makes sense to refactor them at some point. |
After #6370, it seems that we are moving towards bullet representations when they are possible. Wouldn't be better something like this? qr = QuantumRegister(2, "qr")
cr = ClassicalRegister(2, "cr")
circuit = QuantumCircuit(qr, cr)
circuit.h(qr[0]).c_if(cr[0], 1)
circuit.h(qr[1]).c_if(cr[1], 0)
circuit.draw('text', cregbundle=False)
(may understanding of your code is that this change would be easy to make. Please, ignore my comment otherwise) |
Thanks for pointing this out. I have made this change in the latest commit. @javabster I have also made the change in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TharrmashasthaPV, LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Summary
Fixes part of #6475 . This PR extends the current text drawer to support drawing circuits that contain gates or instructions that are conditioned on a single classical bit.
Details and comments
This PR follows #6018 . The current text drawer breaks when trying to draw circuits that contain instructions with single bit conditioning. This PR fixes this issue. Two tests have been added. Below are some examples of circuits drawn after this PR.
With cregbundle = True:
With cregbundle = False: