-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add support for controlled gates to mpl drawer #3779
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds support to the mpl drawer for drawing gates with an arbitrary number of controls on them. Currently the drawer incorrectly represents these gates as a large multiqubit custom gate. This fixes that so it shows the original gate and then adds the controls to it. Fixes Qiskit#3763
mtreinish
requested review from
1ucian0,
ajavadia,
maddy-tod and
nonhermitian
as code owners
February 1, 2020 01:40
When qr = QuantumRegister(3, 'q')
circuit = QuantumCircuit(qr)
circuit.append(HGate().control(2), [qr[0], qr[1], qr[2]])
circuit.draw('mpl') I'm getting the following error:
|
Yes I think it's fine to do a box now and refine later if possible. |
Ok, I'll update this to adjust for that api change |
In Qiskit#3773 the parameters for ControlledGate objects were changed in an incompatible manner which removed the base_gate_name attribute in favor of storing an instance of the inner gate class. This commit updates the usage so that we can set the name of the gate correctly in the visualization.
1ucian0
approved these changes
Feb 5, 2020
1ucian0
added
the
Changelog: Bugfix
Include in the "Fixed" section of the changelog
label
Feb 5, 2020
faisaldebouni
pushed a commit
to faisaldebouni/qiskit-terra
that referenced
this pull request
Aug 5, 2020
* Add support for controlled gates to mpl drawer This commit adds support to the mpl drawer for drawing gates with an arbitrary number of controls on them. Currently the drawer incorrectly represents these gates as a large multiqubit custom gate. This fixes that so it shows the original gate and then adds the controls to it. Fixes Qiskit#3763 * Update game name to reflect api changes In Qiskit#3773 the parameters for ControlledGate objects were changed in an incompatible manner which removed the base_gate_name attribute in favor of storing an instance of the inner gate class. This commit updates the usage so that we can set the name of the gate correctly in the visualization.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This commit adds support to the mpl drawer for drawing gates with an
arbitrary number of controls on them. Currently the drawer incorrectly
represents these gates as a large multiqubit custom gate. This fixes
that so it shows the original gate and then adds the controls to it.
Details and comments
Fixes #3763