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

QasmSimulator fails on a simple circuit #1999

Closed
anedumla opened this issue Nov 14, 2023 · 0 comments
Closed

QasmSimulator fails on a simple circuit #1999

anedumla opened this issue Nov 14, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@anedumla
Copy link

Informations

  • Qiskit Aer version: 0.13.0
  • Python version: 3.10.8
  • Operating system:

What is the current behavior?

The following code returns {'0':1000} with Aer 0.13.0:

import numpy as np
from qiskit_aer import QasmSimulator
from qiskit import QuantumCircuit

qc = QuantumCircuit(1)
qc.ry(- np.pi / 2, 0)
qc.rz(0, 0)
qc.sx(0)
qc.rz(np.pi / 2, 0)
qc.sx(0)
qc.rz(0, 0)
qc.measure_all()
QasmSimulator().run(qc, shots=1000).result().get_counts()

The expected result would be {'1':1000}, which is what older versions of Aer return. Furthermore, if instead of qc.ry(np.pi/2,0) a small angle is added:

qc.ry(- np.pi / 2 + 0.000000001, 0)

the result is again correct. Alternatively, transpiling the circuit gives the correct result, but as far as I know, transpiling shouldn't be necessary to run on a QasmSimulator.

@anedumla anedumla added the bug Something isn't working label Nov 14, 2023
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
None yet
Development

No branches or pull requests

2 participants