-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add the option to wrap circuits in QuantumCircuit.compose
#6659
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
Merged
Conversation
This file contains hidden or 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
Is this part of the plan to merge |
this makes append obsolete when using circuits, so concerning circuits this merges compose and append -- however for instructions/gates that's a different discussion 🙂 |
ajavadia
previously approved these changes
Jul 6, 2021
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
ajavadia
approved these changes
Jul 7, 2021
mtreinish
added a commit
to mtreinish/qiskit-core
that referenced
this pull request
Mar 25, 2022
For the purpose of documentation many of the circuit library classes were using the circuit_library_widget to provide a visualization of the circuit, a QASM definition, and some basic high level statistics about the circuit. However, since Qiskit#6634 and Qiskit#6659 all the circuit library elements are wrapped in an outer Instruction object. This makes the top level object appear as a logical block in the circuit. This has the unindended side effect of causing the widget output to not be super useful, primarily it would should a single logical block for each element and the circuit statistics would be for the single element as opposed to its implementation. This commit address this by adding a single decompose() call around all the statistics and drawing calls inside the widget code. Since we're consistently wrapping every circuit library element the widget will always need to do this now, so instead of calling it directly in the library docstring it's better to just do this in the widget itself.
mergify bot
pushed a commit
that referenced
this pull request
Mar 25, 2022
For the purpose of documentation many of the circuit library classes were using the circuit_library_widget to provide a visualization of the circuit, a QASM definition, and some basic high level statistics about the circuit. However, since #6634 and #6659 all the circuit library elements are wrapped in an outer Instruction object. This makes the top level object appear as a logical block in the circuit. This has the unindended side effect of causing the widget output to not be super useful, primarily it would should a single logical block for each element and the circuit statistics would be for the single element as opposed to its implementation. This commit address this by adding a single decompose() call around all the statistics and drawing calls inside the widget code. Since we're consistently wrapping every circuit library element the widget will always need to do this now, so instead of calling it directly in the library docstring it's better to just do this in the widget itself.
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
Add the option to wrap circuits in
QuantumCircuit.compose
. This makesappend
for circuits obsolete so that for circuit compositions onlycompose
is used.Details and comments
If the circuit to compose is unitary and
wrap=True
, it will be added asGate
to maintain access to unitary operations such as control, otherwise asInstruction
.Here's a brief example:
yields