-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
Hi!
I noticed that when "skipping" a classical bit, meaning not measuring to some bit
See the example below:
from qiskit.circuit import QuantumCircuit
from qiskit_aer import Aer
sim = Aer.get_backend("aer_simulator_statevector")
sim.set_option("cusvaer_enable", True)
circuit = QuantumCircuit(4, 5)
circuit.h(0)
circuit.cx(range(3), range(1, 4))
circuit.measure([0, 1, 2, 3], [0, 1, 2, 4])
print(circuit)
wrong_result = sim.run(circuit, shots=10000).result().get_counts()
print("Wrong:", wrong_result)
sim.set_option("cusvaer_enable", False)
correct_result = sim.run(circuit, shots=10000).result().get_counts()
print("Correct:", correct_result) ┌───┐ ┌─┐
q_0: ┤ H ├──■───────┤M├──────────────
└───┘┌─┴─┐ └╥┘ ┌─┐
q_1: ─────┤ X ├──■───╫──────┤M├──────
└───┘┌─┴─┐ ║ └╥┘┌─┐
q_2: ──────────┤ X ├─╫───■───╫─┤M├───
└───┘ ║ ┌─┴─┐ ║ └╥┘┌─┐
q_3: ────────────────╫─┤ X ├─╫──╫─┤M├
║ └───┘ ║ ║ └╥┘
c: 5/════════════════╩═══════╩══╩══╩═
0 1 2 4
Wrong: {'00000': 4993, '00111': 5007}
Correct: {'10111': 5026, '00000': 4974}
I suspect there might be some missing bookkeeping of the indices of classical registers in the cusvaer backend.
Thanks!
Nate
Metadata
Metadata
Assignees
Labels
No labels