I have been doing some experiments on classes of random matrices, and it seems (visually) that the distribution of eigenvalue spacings is consistent with GOE or GUE or GSE. Unfortunately, to test this, I would like to (a) be able to generate GOE/GUE/GSE spacing variates (I suppose I COULD generate very large Gaussian matrices and compute their eigenvalues, but this seems not very fast...), or even have some formula for the distribution function (there is the Wigner surmise, but it is not quite accurate). There are horriblelooking formulas in Mehta's book, but they don't seem usable, somehow. Algorithms/code must exist somewhere  any pointers would be appreciated.

2$\begingroup$ It is known that the GOE spectral distn is the same as that of a tridiagonal random matrix whose offdiagonal entries are square roots of chisquared and whose diagonal entries are standard normal  would it be any quicker to sample from these and then use some offthepeg code to compute the eigenvalues from the tridiagonal form? $\endgroup$– Yemon ChoiFeb 5, 2011 at 23:27

$\begingroup$ @Yemon that could certainly help a lot, but I wonder what you mean by "the same". That is, it might be that the limiting distributions are the same, but one needs to know some explicit bounds on the speed of convergence to make this computationally useful. Is anything like that known? $\endgroup$– Igor RivinFeb 5, 2011 at 23:48

$\begingroup$ In Yemon's comment, "the same" means literally the same for matrices of any size, not just asymptotically. $\endgroup$– Mark MeckesFeb 6, 2011 at 0:24

$\begingroup$ As Mark says (you just tridiagonalize the given symmetric matrix, using e.g. a sequence of Householder reflections). I rediscovered this some years ago, but I think it is in a paper of Trotter from the 1970s, and has probably been independently observed in several places. $\endgroup$– Yemon ChoiFeb 6, 2011 at 0:41

1$\begingroup$ For the details written out, see section 4.5 of this book: math.umn.edu/~zeitouni/technion/cupbook.pdf $\endgroup$– Mark MeckesFeb 6, 2011 at 0:47
2 Answers
I suggest you to take a look at the paper "How to Generate Random Matrices from the Classical Compact Groups" by F. Mezzadri, Notices AMS 54 (5), 592604 (2007). Can be downloaded freely from here: http://www.google.es/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=http%3A%2F%2Fwww.ams.org%2Fnotices%2F200705%2Ffeamezzadriweb.pdf&rct=j&q=How%20to%20Generate%20Random%20Matrices%20from%20the%20Classical%20Compact%20Groups&ei=WBNTb6nFZaShAfS2bWTDw&usg=AFQjCNESHv00uIyATuY1NETwTfH5IO1fhQ&cad=rja

1$\begingroup$ @Andrei: this is a very cool/useful reference, but unfortunately it does not quite answer the question, since my question is equivalent to randomly generating spectra of symmetric or hermitian matrices, so generating random (eg) unitary matrices does not seem to help... $\endgroup$ Feb 5, 2011 at 23:52
If 2% accuracy is sufficient, then you can just use Wigner's surmise. It is unlikely you will be able to beat that accuracy by generating random matrices and sampling the eigenvalue spacing. If higher accuracy is needed, you can find the spacing distribution by numerical integration of a Painleve differential equation, see Forrester & Witte arXiv:mathph/0009023
A tabulated solution is in Haake's book "Quantum Signatures of Chaos", that is probably the easiest way to go.