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

Fix error in plot_state_city that negative value in real is not displayed #10862

Closed
wants to merge 1 commit into from

Conversation

mi2valley
Copy link

@mi2valley mi2valley commented Sep 19, 2023

Summary

Fix an error that the negative value is not displayed when a state with a real negative value is used as input for the plot_state_city method.

Details and comments

A simple example that shows the original problem:

from qiskit import QuantumCircuit, transpile
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from qiskit_ibm_runtime import QiskitRuntimeService, Sampler, Estimator, Session, Options
from qiskit.quantum_info import DensityMatrix

service = QiskitRuntimeService(channel="ibm_quantum")

circ = QuantumCircuit(2)

circ.x(0)
circ.h(0)
circ.cx(0, 1)

dm = DensityMatrix.from_instruction(circ)

plot_state_city(dm, title='Density Matrix')
dm

dm_issue

After fixing plot_state_city method:

dm_fix

@mi2valley mi2valley requested review from nonhermitian and a team as code owners September 19, 2023 11:53
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Sep 19, 2023
@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

CLAassistant commented Sep 19, 2023

CLA assistant check
All committers have signed the CLA.

@AlexanderGroeger
Copy link
Contributor

AlexanderGroeger commented Sep 20, 2023

This might already be fixed in my PR, but it is still waiting for review.

@mi2valley
Copy link
Author

This might already be fixed in my PR, but it is still waiting for review.

I tried plot_state_city in your PR, but negative values in real did not show up as bars.

Could you please check if the bars for negative values are displayed as shown in the second density matrix figure attached?
I think we are fixing another issue.

@AlexanderGroeger
Copy link
Contributor

Could you please check if the bars for negative values are displayed as shown in the second density matrix figure attached? I think we are fixing another issue.

Yep. It looks like this is a separate issue.
I have removed the line causing this issue in my PR, and it yields the figure you have presented.

@1ucian0 1ucian0 self-assigned this Sep 21, 2023
@1ucian0 1ucian0 added this to the 0.45.0 milestone Sep 21, 2023
@jakelishman jakelishman added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Oct 10, 2023
@1ucian0
Copy link
Member

1ucian0 commented Oct 16, 2023

This PR seems supersede by #10590, so closing for now. Thanks!

@1ucian0 1ucian0 closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants