haar_rand_unitary¶
-
forest.benchmarking.operator_tools.random_operators.
haar_rand_unitary
(dim: int, rs=None) → numpy.ndarray¶ Given a Hilbert space dimension dim this function returns a unitary operator U ∈ C^(dim by dim) drawn from the Haar measure [MEZ].
The error is of order 10^-16.
[MEZ] How to generate random matrices from the classical compact groups. Mezzadri. Notices of the American Mathematical Society 54, 592 (2007). http://www.ams.org/notices/200705/fea-mezzadri-web.pdf https://arxiv.org/abs/math-ph/0609050 Parameters: - dim – Hilbert space dimension (scalar).
- rs – Optional random state
Returns: Returns a dim by dim unitary operator U drawn from the Haar measure.