Please refer to the topic on function Statevector: https://qiskit.org/documentation/stubs/qiskit.quantum_info.Statevector.html#statevector

instantiate a quantum circuit of one qubit: QuantumCircuit(1)
instantiate the form of the state vector for this one qubit: Statevector([sqrt(0.3), sqrt(0.7)])

which says that this one qubit is described by a state vector of the form $|\psi\rangle = \sqrt(0.3)|0\rangle + \sqrt(0.7)|1\rangle$

Following the spirit of the documentation, the below must say $|\psi\rangle = \sqrt(0.2)|0\rangle + \sqrt(0.2)|1\rangle + \sqrt(0.6)|2\rangle$

Statevector([sqrt(0.2), sqrt(0.2), sqrt(0.6)])?

The code below evaluates programmatically but I am unsure it is sane.


1 Answer 1


Qiskit's Statevector is designed to represent the state of quantum systems of any dimension, not two-dimensional systems (i.e., qubits) only.

For example, the below code snippet creates a Statevector instance which represents a system composed of two subsystems, the first subsystem is two-dimensional and the second is three-dimensional:

psi = Statevector([1 / sqrt(6), 1 / sqrt(6), 1 / sqrt(6), 1 / sqrt(6), 1 / sqrt(6), 1 / sqrt(6)],
      dims=(2, 3))

On course when you initialize the Statevector using a QuantumCircuit the subsystems will be considered as two-dimensional.

  • $\begingroup$ It is still confusing to me. How does the Qiskit distinguish between the dimension of a subsystem? Is my guess correct that this is distinguish by the dimension argument seen in dims? First two element in the list L of a statevector is the first subsystem and the last 3 elements refers to the probability coefficient of the second subsystem? $\endgroup$
    – Physkid
    Oct 28 at 7:21
  • $\begingroup$ Qiskit uses dims argument if exixts. Otherwise, it depends on the dimension of the data argument. If the dimension is a power of two ($d = 2^n$) the state will be initialized as an $n$-qubit state. If it is not a power of two the state will have a single $d$-dimensional subsystem. In general, the subsystems could be entangled. So, we cannot say "this part of data is the state of the first subsystem, and that part is the state of the second subsystem". The whole array represents the state of the whole system. $\endgroup$ Oct 28 at 11:40
  • $\begingroup$ This is such a odd way of defining an argument in the function... $\endgroup$
    – Physkid
    Oct 29 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.