rqutils.paulis.general.components

rqutils.paulis.general.components(matrix: ArrayLike, dim: int | integer | Sequence[int | integer] | None = None, npmod: ModuleType = <module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/rqutils/envs/v0.2.0/lib/python3.12/site-packages/numpy/__init__.py'>) NDArray[complex128]

Return the Pauli decomposition coefficients \(\nu_{k_1 \dots k_n}\) of the matrix.

Parameters:
  • matrix – Matrix to decompose. The last two dimensions of the array are dotted with the Pauli matrices.

  • dim – Subsystem dimensions. The product of subsystem dimensions must match the matrix dimension. If None, the matrix is assumed to represent a single system.

Returns:

A complex array of shape (…, d1**2, d2**2, …) where d1, d2, … are the subsystem dimensions.

Raises:

ValueError – If prod(dim) does not match the matrix dimension.