-
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
Improve qiskit.circuit.QuantumCircuit page #13300
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Eric Arellano <[email protected]>
Co-authored-by: Eric Arellano <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 12834300454Details
💛 - Coveralls |
Co-Authored-By: Kaelyn Ferris <[email protected]>
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.
Thank you! I have some minor suggestions but generally it looks great. I think this'll help a lot; seeing a concrete example of what the output looks like is often a big help for me.
qiskit/circuit/quantumcircuit.py
Outdated
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit | ||
|
||
q = QuantumRegister(2) | ||
c = ClassicalRegister(2) | ||
qc = QuantumCircuit(q, c) | ||
|
||
qc.metadata = {'experiment_type': 'Bell state experiment'} | ||
|
||
print(qc.metadata) |
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.
Same here as with .name
. Also, do you know if this is needed since you've also added an example in metadata property? I'm not sure how it works
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.
I'm not sure! I'll do it just for the sake of practicing rewriting the code to your suggestion...
qiskit/circuit/quantumcircuit.py
Outdated
from qiskit.circuit.library import GroverOperator, Diagonal | ||
from qiskit.providers.fake_provider import GenericBackendV2 | ||
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager | ||
|
||
# Create circuit to test transpiler on | ||
oracle = Diagonal([1] * 7 + [-1]) | ||
qc = QuantumCircuit(3) | ||
qc.h([0, 1, 2]) | ||
qc = qc.compose(GroverOperator(oracle)) |
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.
Nice example! Just a suggestion for a simpler circuit
from qiskit.circuit.library import GroverOperator, Diagonal | |
from qiskit.providers.fake_provider import GenericBackendV2 | |
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager | |
# Create circuit to test transpiler on | |
oracle = Diagonal([1] * 7 + [-1]) | |
qc = QuantumCircuit(3) | |
qc.h([0, 1, 2]) | |
qc = qc.compose(GroverOperator(oracle)) | |
from qiskit.providers.fake_provider import GenericBackendV2 | |
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager | |
# Create circuit to test transpiler on | |
qc = QuantumCircuit(3) | |
qc.h([0, 1, 2]) |
Co-authored-by: Frank Harkins <[email protected]>
Co-authored-by: Frank Harkins <[email protected]>
Co-authored-by: Frank Harkins <[email protected]>
Co-authored-by: Frank Harkins <[email protected]>
One or more of the following people are relevant to this code:
|
Summary
Add code examples where useful, and copyedit if necessary; closes #13299
Add examples for
Moving the rest to a new PR to break up the work in more manageable pieces!