When creating multi-bit quantum and classical registers, what is the ordering of MSB to LSB? For instance, I created a quantum register via
import qiskit
qr = qiskit.QuantumRegister(2, name='qr')
Is qr[1]
the MSB, or is it qr[0]
?
For an example of why I'm asking, please review the following:
import qiskit
qr = qiskit.QuantumRegister(2, name='qr')
cr = qiskit.ClassicalRegister(2, name='cr')
qc = qiskit.QuantumCircuit(qr, cr)
# Result should be Bell state (|00>+|11>)/sqrt(2)
qc.h(qreg[0])
qc.cx(qreg[0], qreg[1])
# Result should be state |00>
qc.cx(qreg[0], qreg[1])
qc.h(qreg[0])
# Result should be state |10>
qc.x(qreg[0])
qc.measure(qreg, creg)
qc.draw()
At the end here I expect the quantum register to be in the state |10>
, but the histogram below shows the state |01>
. This indicates to me the MSB is the right-most bit, but I don't understand why the authors would do that. Is there some fundamental misunderstanding in my approach?
EDIT: Also the example is a bit convoluted--I initialized a Bell state because that's what the input to my circuit will be, but the same result happens with just the NOT gate on qr[0]
.