You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
As a beginner in quantum computing and Qiskit I have already figured out that Qiskit is using the Little Endian method when dealing with qubits. Thus the matrix of the CX gate in Qiskit is:
[1 0 0 0
0 0 0 1
0 0 1 0
0 1 0 0]
Whilst in other places (who uses the Big Endian method) the matrix of the CX gate is:
[1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0]
So far so good.
But then I encountered [this](https://learn.qiskit.org/course/introduction/entangled-states#entangled-30-0) problem in the Qiskit introduction course - and it looks like that the CX matrix applied is the second one above.
For that code:
MESSAGE = '11'
qc_alice = QuantumCircuit(2,2)
if MESSAGE[-1]=='1':
qc_alice.x(0)
if MESSAGE[-2]=='1':
qc_alice.x(1)
qc_alice.h(1)
qc_alice.cx(1,0)
ket = Statevector(qc_alice)
ket.draw()
I expected the result: -[1/sqrt(2)]|01> + [1/sqrt(2)]|11> But the result is: [1/sqrt(2)]|01> - [1/sqrt(2)]|10>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
As a beginner in quantum computing and Qiskit I have already figured out that Qiskit is using the Little Endian method when dealing with qubits. Thus the matrix of the CX gate in Qiskit is:
[1 0 0 0
0 0 0 1
0 0 1 0
0 1 0 0]
Whilst in other places (who uses the Big Endian method) the matrix of the CX gate is:
[1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0]
So far so good.
But then I encountered
[this](https://learn.qiskit.org/course/introduction/entangled-states#entangled-30-0)
problem in the Qiskit introduction course - and it looks like that the CX matrix applied is the second one above.For that code:
MESSAGE = '11'
qc_alice = QuantumCircuit(2,2)
if MESSAGE[-1]=='1':
qc_alice.x(0)
if MESSAGE[-2]=='1':
qc_alice.x(1)
qc_alice.h(1)
qc_alice.cx(1,0)
ket = Statevector(qc_alice)
ket.draw()
I expected the result: -[1/sqrt(2)]|01> + [1/sqrt(2)]|11>
But the result is: [1/sqrt(2)]|01> - [1/sqrt(2)]|10>
What am I missing?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions