-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix issue with ControlFlowOps and cregbundle and mods to circuit drawer testing #10804
Conversation
One or more of the the following people are requested to review this:
|
Based on the amount of changes, I would consider this bugfix for next stable, instead of patch release. But I dont feel super strongly about it. |
Edwin: this appears to have quite a few merge conflicts at the moment - do you know what the status of this PR is now? |
I'll close it. Half of it is done in #10842 and the rest should be done in new PRs. |
Ah ok, that definitely makes things easier thanks! |
Summary
Fixes an issue where use of ControlFlowOps would force cregbundle to False.
Changes function calls in "mpl" and "text" drawer tests.
Details and comments
When #10207 and #10414 were done to add display of internal circuits in
ControlFlowOps
to the mpl and text drawers, the drawings did not properly handlecregbundle=True
. This was due to a check forcargs
that inadvertently affectedControlFlowOps
. In addition, the check was not looking inside the circuits ofControlFlowOps
which meant the check could miss composite gates withcargs
that should be settingcregbundle=False
.There was a similar
cregbundle
check due to the use ofwire_order
that was done at the beginning of thecircuit_drawer
function. It was appropriate to put thecargs
check there as well, but both of these checks create a problem for thempl
andtext
test suites.test_circuit_text_drawer.py
uses_text_circuit_drawer
which is a subsidiary function tocircuit_drawer
. This means the 2 checks described above never get done during the testing, which can cause incorrect output. Similarly formpl
tests which use_matplotlib_circuit_drawer
for testing.This also means we are not really testing the user experience since they use
QuantumCircuit.draw
orcircuit_drawer
to display circuits. The solution was to convert the tests suites to usecircuit_drawer
instead of the subsidiary functions.It was also discovered that the
encoding
option for_text_circuit_drawer
did not exist incircuit_drawer
which meant users could not set it. This was added tocircuit_drawer
andQuantumCircuit.draw
.In fixing the
cregbundle
issue in thempl
drawer, it was discovered that the condition lines could, for larger numbers of bits in a creg, overlay thecregbundle
info. Minor adjustments were made to thecregbundle
display and this is the reason for the extra updatedmpl
reference images.A few consistency and cleanup changes left over from #10207 and #10414 were done as well.