Generate Random Orthonormal or Unitary Matrix
Generates random orthonormal or unitary matrix of size 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"))
n |
positive integer. |
type |
orthonormal (i.e., real) or unitary (i.e., complex) matrix. |
Generates orthonormal or unitary matrices 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),
Orthogonal (or unitary) matrix Q
of size n
, that is
Q %*% t(Q)
resp. Q %*% t(Conj(Q))
is the unit matrix
of size n
.
rortho
was deprecated and eventually removed in version 2.1.7.
G. W. Stewart (1980). “The Efficient Generation of Random Orthogonal Matrices with an Application to Condition Estimators”. SIAM Journal on Numerical Analysis, Vol. 17, No. 3, pp. 403-409.
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.