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

BackendResult from circuit with non-default classical register has incorrect c_bits #339

Closed
cqc-alec opened this issue May 29, 2024 · 0 comments · Fixed by #407
Closed
Assignees
Labels
bug Something isn't working

Comments

@cqc-alec
Copy link
Collaborator

b = IBMQBackend("ibm_nazca")
c = Circuit(2)
c.add_c_register("b", 2)
c.H(0).CX(0,1).Measure(Qubit(0), Bit("b", 0)).Measure(Qubit(1), Bit("b", 1))
c1 = b.get_compiled_circuit(c, optimisation_level=1)
h = b.process_circuit(c1, n_shots=10)
r = b.get_result(h)
print( r.get_counts(cbits=[Bit("b", 0), Bit("b", 1)]))

Error:

ValueError: Requested Bit not in result.
print(r)

Output:

BackendResult(q_bits={},c_bits={c[0]: 0, c[1]: 1},counts=Counter({OutcomeArray([[0]], dtype=uint8): 7, OutcomeArray([[192]], dtype=uint8): 3}),shots=None,state=None,unitary=None,density_matrix=None)
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

Successfully merging a pull request may close this issue.

1 participant