Random Orthogonal Matrices

Abel’s solution gives you a more-or-less random matrix which happens to be orthogonal. (Nothing wrong with that, if that’s all you need.)

If you need a random draw from the uniform distribution over the space of orthogonal matrices of rank n, I think you want something like

using RandomMatrices
Q = rand(Haar(1),n) 
# or randfast(Haar(1),n) if you are impatient and not fastidious

I remember being annoyed at how hard this was to find.

17 Likes