For reference, the linked paper is Composite parameterization and Haar measure for all unitary and special unitary groups by Christoph Spengler, Marcus Huber and Beatrix C. Hiesmayr (J. Math. Phys. 53, 013501 (2012)).


I am implementing an algorithm that "scrambles" a Hamiltonian by a random (w.r.t. to the Haar measure) special unitary operator:
$$H\_{\text{scram}} = UH\_0U^\dagger.$$


I would like these unitaries to be parameterized as the algorithm minimizes a quantity by varying $U$. I found that [this](https://arxiv.org/pdf/1103.3408.pdf) paper provides precisely what I need as it gives a parameterization of $\mathrm{SU}(N)$ and the Haar measure in terms of the same parameters.


It would not be too bad to implement the results of the linked paper from scratch, but I was wondering if a Python package already exists which samples random special unitaries and provides a parameterization of said unitaries, so that I can scramble a Hamiltonian as defined above and then perform an optimization procedure w.r.t. the parameters parameterizing $\mathrm{SU}(N)$.



Does there exist a Python package that samples random special unitary matrices such that the matrices are parameterized
I would just use Euler angles to parameterise the unitary, and then vary the angles according to the Haar measure. Below I copy the relevant equations from [Zyczkowski and Kus](http://yaroslavvb.com/papers/zyczkwoski-random.pdf). I do not have a Python code (when I used this method we were still using Fortran...), but it should be only a few lines. (For $SU(N)$ instead of $U(N)$ you would omit the angle $\alpha$.)


There is an alternative method that is computationally more intensive, but can be explained in one line: Parameterize a general complex symmetric matrix $H$ with normally distributed elements and compute the unitary matrix $U$ of eigenvectors.




---


![](https://i.stack.imgur.com/64VXe.png)
