Statevector.from_label

classmethod Statevector.from_label(label)[source]

Return a tensor product of Pauli X,Y,Z eigenstates.

Table 15 Single-qubit state labels

Label

Statevector

"0"

\([1, 0]\)

"1"

\([0, 1]\)

"+"

\([1 / \sqrt{2}, 1 / \sqrt{2}]\)

"-"

\([1 / \sqrt{2}, -1 / \sqrt{2}]\)

"r"

\([1 / \sqrt{2}, i / \sqrt{2}]\)

"l"

\([1 / \sqrt{2}, -i / \sqrt{2}]\)

Parameters

label (string) – a eigenstate string ket label (see table for allowed values).

Returns

The N-qubit basis state density matrix.

Return type

Statevector

Raises

QiskitError – if the label contains invalid characters, or the length of the label is larger than an explicitly specified num_qubits.