French
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.quantum_info.PauliList.to_matrix

PauliList.to_matrix(sparse=False, array=False)[source]

Convert to a list or array of Pauli matrices.

For large PauliLists converting using the array=True kwarg will be more efficient since it allocates memory a full rank-3 Numpy array of matrices in advance.

Table 4 Pauli Representations

Label

Symplectic

Matrix

"I"

\([0, 0]\)

\(\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)

"X"

\([1, 0]\)

\(\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\)

"Y"

\([1, 1]\)

\(\begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}\)

"Z"

\([0, 1]\)

\(\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\)

Paramètres
  • sparse (bool) – if True return sparse CSR matrices, otherwise return dense Numpy arrays (Default: False).

  • array (bool) – return as rank-3 numpy array if True, otherwise return a list of Numpy arrays (Default: False).

Renvoie

A list of dense Pauli matrices if array=False and sparse=False. list: A list of sparse Pauli matrices if array=False and sparse=True. array: A dense rank-3 array of Pauli matrices if array=True.

Type renvoyé

list