Skip to content
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 user config option to control default reverse_bits value in circuit_drawer #9186

Closed
wants to merge 8 commits into from

Conversation

diemilio
Copy link
Contributor

Summary

Fixes #9150.

Details and comments

This PR adds the option circuit_reverse_bits to the user config file to modify the default behavior of the reverse_bits option in the circuit_drawer. For example, the following configuration in the settings.conf file:

[default]
circuit_drawer = mpl
state_drawer = latex
circuit_reverse_bits = True

the circuit drawer will display a circuit with the most significant bit at the top without explicitly passing the reverse_bits=True option to the draw() method:

from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
n = 4
qr = QuantumRegister(n, name='q')
cr = ClassicalRegister(n, name='c')
qc = QuantumCircuit(qr,cr)
qc.h(range(n))
for i in range(n-1,0,-1):
    qc.cx(i,i-1)
qc.barrier()
qc.measure(qr,cr)
qc.draw()

image

@diemilio diemilio requested review from a team and nonhermitian as code owners November 22, 2022 21:45
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Nov 22, 2022
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ diemilio
❌ Diego Serrano


Diego Serrano seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@diemilio
Copy link
Contributor Author

Closing this because there are some authorship issues with the first few commits. Will fix and submit new PR.

@diemilio diemilio closed this Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option in user config file to control reverse_bits in circuit_drawer
3 participants