Last chance! 50% off unlimited learning
Sale ends in
n
.Will be needed in applications that explore high-dimensional data spaces, for example optimization procedures or Monte Carlo methods.
randortho(n, type = c("orthonormal", "unitary"))
rortho(n)
Q
of size n
, that is
Q %*% t(Q)
resp. Q %*% t(Conj(Q))
is the unit matrix
of size n
.
Q
, that is
t(Q)
resp t(Conj(Q))
is inverse to Q
. The randomness
is meant with respect to the (additively invariant) Haar measure on
$O(n)$ resp. $U(n)$.Stewart (1980) describes a way to generate such matrices by applying Householder transformation. Here a simpler approach is taken based on the QR decomposition, see Mezzadri (2006),
F. Mezzadri (2006). ``How to generate random matrices from the classical compact groups''. NOTICES of the AMS, Vol. 54 (2007), 592-604. (arxiv.org/abs/math-ph/0609050v2)
Q <- randortho(5)
zapsmall(Q %*% t(Q))
zapsmall(t(Q) %*% Q)
Run the code above in your browser using DataLab