rqutils.paulis.components

rqutils.paulis.components(matrix, dim=None, npmod=np)

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

Parameters
  • matrix (Union[Number, Sequence[Number], numpy.ndarray]) – Matrix to decompose. The last two dimensions of the array are dotted with the Pauli matrices.

  • dim (Union[int, Sequence[int], None]) – Subsystem dimensions. The product of subsystem dimensions must match the matrix dimension. If None, the matrix is assumed to represent a single system.

Return type

numpy.ndarray

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.