-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unitary matrices produced by Stewart
do not seem to be distributed with Haar measure
#65
Comments
I'm not a maintainer of this package, but I have recently been studying the same problem in order to sample random unitaries for my own package, and I believe I understand the issue. First of all, in order to correct the sign of the matrix, you need to transform it from a bunch of Householder reflections to a regular matrix, but this transformation alone is O(d^3), which kind of defeats the purpose of Stewart's algorithm in offering a O(d^2) method. In his paper he proposes storing the unitary as the set of householder reflections together with the diagonal matrix to correct the signs. Which of course works, but some type other than Secondly, I don't think what you are doing is correct. You can't correct the sign via a scalar. And furthermore Julia's |
Note this package doesn’t really have an active maintainer so if you wish to contribute and eventually take over as maintainer it would be really appreciated |
I appreciate the vote of confidence, but I'm afraid this package needs more love than I can give. I can fix the implementation of Stewart's algorithm, but I have neither the time nor the knowledge needed for something deeper. Maybe it's a good idea to advertise the package in JuliaCon? There must be plenty of people familiar with random matrix theory there, and I don't think this is a case where we need to be afraid of Jia Tan. |
Hi there,
First of all thanks for this nice package. I had a problem when I tried to use the function$\rho(\theta) = \frac{1}{2 \pi}$ , where $\theta$ is the argument of the eigenvalues of the generated matrices.
Stewart
to generate unitary matrices in my simulation though. The function rests in the fileHaarMeasure.jl
, so I assume that it's intended to produce unitary matrices distributed with Haar measure. According to [1], the normalized eigenvalue density isI tried to reproduce Figure 2 in [1] with the following script:
The resulting density does not seem to be constant; instead it looks like the wrong distribution in Figure 1 in [1]:
![density_1](https://user-images.githubusercontent.com/109823771/180641874-daf207e1-3cf7-47bc-b0a7-9ffbd9de0f1e.png)
Looking into the source code, it seems that the function calls
larfg
from LAPACK to generate Householder reflectors, but the reflectors themselves are not rotated as suggested in [1] (specifically equation (7.22)). To test out I just made a simple change to the source code:Then I modified the script and carried out the small experiment again:
The density now appears constant:
![density_2](https://user-images.githubusercontent.com/109823771/180642113-6ba08147-cf22-4b95-91d5-74e7506ff049.png)
Perhaps I'm missing something here, and it would be great to hear your opinion. Cheers!
References
[1] Mezzadri, F., 2006. How to generate random matrices from the classical compact groups. arXiv preprint math-ph/0609050.
The text was updated successfully, but these errors were encountered: