ffsim.random.random_unitary

ffsim.random.random_unitary(dim, *, seed=None, dtype=<class 'complex'>)[source]

Return a random unitary matrix distributed with Haar measure.

Parameters:
  • dim (int) – The width and height of the matrix.

  • seed – A seed to initialize the pseudorandom number generator. Should be a valid input to np.random.default_rng.

  • dtype – The data type to use for the result.

Return type:

ndarray

Returns:

The sampled unitary matrix.

References