"Bruno Luong" <firstname.lastname@example.org> wrote in message <email@example.com>... > "G" wrote in message <firstname.lastname@example.org>... > > > > How did you come up with this formula for uniform random rotation matrices? Is there a proof or some literature available? > > A proof, probably. The fact is straight from the property of rotational invariant of canonical multivariate Gaussian pdf. > > Bruno
The code provided in this thread:
[Q, R] = qr(randn(n)) Q = Q*diag(sign(diag(R)))
Is a correct way to generate random matrices from O(n), the orthogonal group. For reference, see "How to generate random matrices from the classical compact groups", Francesco Mezzadri, Notices of ACM, Volume 54, Number 5, 2007.
The problem is that det(Q) may be -1, and therefore sometimes Q is not a rotation matrix as desired. I'm thinking of two possibilities for det(Q) < 0:
1) exchange any two columns of Q, or 2) compute the svd of Q = USV^T, and then compute Q2 := U diag([ones(1, n - 1), -1]) V^T. The Q2 is then the rotation matrix closest to Q in the Frobenius norm.
I am unable to say what effect these have on the probability measure. Anyone?