Given the following code:
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(2)
This calculates what the state vector of our qubits would be
after passing through the circuit 'qc'
ket = Statevector(qc)
The code below writes down the state vector.
Since it's the last line in the cell, the cell will display it as output
ket.draw()
when executed, will output:
Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j] \n dims=(2, 2))
which is expected result, as per my understanding, as $|00\rangle = [1 0 0 0 ]$
But when we apply $x$-gate on qubit 0 as in:
qc.x(0)
ket = Statevector(qc)
ket.draw()
the output is:
Statevector([0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j]\n dims=(2, 2))
which is not correct, as per my understanding, because applying the $x$-gate on first qubit will make the multi-qubit state $|10\rangle = [0 0 1 0]$, but the output of the above is $[0 1 0 0]$.
Please help me to understand this?
Also, here in the outputs dims=(2, 2))
, shouldn't it be dims=(4, 1))
?