PermutationMatrix.random

static PermutationMatrix.random(num_qudits, radixes=[])

Sample a random unitary from the haar distribution.

Parameters:
  • num_qudits (np.ndarray) – The number of qudits for the matrix. This is not the dimension.

  • radixes (Sequence[int]) – The radixes for the Unitary.

Returns:

A random unitary matrix.

Return type:

(UnitaryMatrix)

Raises:
  • ValueError – If num_qudits is nonpositive.

  • ValueError – If the length of radixes is not equal to num_qudits.