cirq.testing.random_unitary

cirq.testing.random_unitary(dim: int, *, random_state: cirq.RANDOM_STATE_OR_SEED_LIKE = None) → numpy.ndarray[source]

Returns a random unitary matrix distributed with Haar measure.

Parameters
  • dim – The width and height of the matrix.

  • random_state – A seed to use for random number generation.

Returns

The sampled unitary matrix.

References

‘How to generate random matrices from the classical compact groups’ http://arxiv.org/abs/math-ph/0609050