PauliTable.to_matrix

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

Convert to a list or array of Pauli matrices.

For large PauliTables 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 10 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}\)

Parameters
  • 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).

Returns

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.

Return type

list