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

Sampling issue of Qasm simulator at BasicAer #2744

Closed
chunfuchen opened this issue Jul 5, 2019 · 0 comments · Fixed by #2790
Closed

Sampling issue of Qasm simulator at BasicAer #2744

chunfuchen opened this issue Jul 5, 2019 · 0 comments · Fixed by #2790
Assignees
Labels
bug Something isn't working
Projects
Milestone

Comments

@chunfuchen
Copy link
Contributor

Information

  • Qiskit Terra version: the master branch
  • Python version: 3.7
  • Operating system: macOS 10.14

What is the current behavior?

Produce the correct measurement result

Steps to reproduce the problem

from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, Aer, execute
basicaer = BasicAer.get_backend('qasm_simulator')
aer = Aer.get_backend('qasm_simulator')
qr = QuantumRegister(2)
cr = ClassicalRegister(1)
qc = QuantumCircuit(qr, cr)
qc.h(qr[0])
qc.x(qr[1])
qc.measure(qr[1], cr[0])

basicaer_result = execute(qc, backend=basicaer).result().get_counts()
aer_result = execute(qc, backend=aer).result().get_counts()

print(basicaer_result)
print(aer_result)

What is the expected behavior?

the results should be {'1': 1024} but BasicAer returns wrong results.

Suggested solutions

No idea but it is related to the PR #2735 since before this PR, basic aer works correctly.
Furthermore, if all quantum registers are measured, the basic aer works okay. It seems that this issue only happened when only a part of quantum registers are measured.

@chunfuchen chunfuchen changed the title Qasm simulator at BasicAer is incorrect Sampling issue of Qasm simulator at BasicAer Jul 5, 2019
@ajavadia ajavadia added the bug Something isn't working label Jul 5, 2019
@ajavadia ajavadia added this to To do in BasicAer via automation Jul 5, 2019
@ajavadia ajavadia added this to the 0.9 milestone Jul 5, 2019
BasicAer automation moved this from To do to Done Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
BasicAer
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants