3
$\begingroup$

When I execute the following circuit, I expect that in both classical registers, the content is identical.

q = QuantumRegister(1)
c = ClassicalRegister(2)
circuit = QuantumCircuit(q, c)
circuit.h(q[0])
circuit.measure(q[0], c[0])
circuit.measure(q[0], c[1])

backend = BasicAer.get_backend('qasm_simulator')
job = execute(circuit, backend, shots=100)
result = job.result()
counts = result.get_counts(circuit)

print(counts)

And the results are {'01': 44, '00': 56}, however I expect {'11': 44, '00': 56}

When I run the same circuit in the IBM Quantum Experience with the same simulator, I get the expected results.

What do I miss?

$\endgroup$
2
  • $\begingroup$ Which version of Qiskit Terra are you running? $\endgroup$
    – met927
    Nov 6, 2019 at 10:52
  • $\begingroup$ Qiskit Terra was qiskit-terra-0.8.2 after running the update, which solved the problem I have qiskit-terra-0.10.0 now. $\endgroup$ Nov 6, 2019 at 11:25

1 Answer 1

7
$\begingroup$

When I run your code on the most recent version of qiskit I get the expected results {'11': 55, '00': 45}. It could be the case therefore that you are running an older version of qiskit and this has been fixed recently. I would suggest updating your version using pip install --upgrade qiskit

$\endgroup$
1
  • 1
    $\begingroup$ Thank you for the suggestion. I had installed qiskit-0.11.1 and updated to qiskit-0.13.0. $\endgroup$ Nov 6, 2019 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.