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 ability to get counts from statevectors and density matrices #3514

Merged
merged 10 commits into from
Nov 27, 2019
Merged

Add ability to get counts from statevectors and density matrices #3514

merged 10 commits into from
Nov 27, 2019

Conversation

nonhermitian
Copy link
Contributor

Summary

Adds the ability to get counts from statevectors. The counts are the numerically exact probabilities that one would expect to come from a given statevector. This is very useful in comparing theoretical bitstring output distributions verses those actually obtained in the experiment or noisy simulations.

Related to #3510

Details and comments

@ajavadia
Copy link
Member

Can we make this work for density matrices as well?

I think a convenient function to obtain counts from states is nice, but also we need some way of getting probability of any observable, not just computational basis. @chriseclectic mentioned something along these lines exists for statevector but I couldn't really find it. Can you paste some code examples here @chriseclectic ?

@nonhermitian nonhermitian changed the title Add ability to get counts from statevectors Add ability to get counts from statevectors and density matrices Nov 26, 2019
@nonhermitian
Copy link
Contributor Author

Now works for density matrix objects as well.

@mergify mergify bot merged commit 13f75e2 into Qiskit:master Nov 27, 2019
Backends, Qobj, and Result automation moved this from To do to Done Nov 27, 2019
@mtreinish mtreinish added the Changelog: New Feature Include in the "Added" section of the changelog label Dec 4, 2019
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
…kit#3514)

* add state to counts

* add to result and tests

* style

* cleanup

* add DM version and tests

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants