cirq.testing.random_density_matrix

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

Returns a random density matrix distributed with Hilbert-Schmidt measure.

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

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

Returns

The sampled density matrix.

Reference:

‘Random Bures mixed states and the distribution of their purity’ https://arxiv.org/abs/0909.5094