simOrtho {whitening} | R Documentation |
simOrtho
generates a random orthogonal matrix.
simOrtho(d, nonNegDiag = FALSE)
d |
The dimension of the orthogonal matrix. |
nonNegDiag |
force the elements on the diagonal to be nonnegative (default: FALSE). |
The algorithm is based on QR decomposition of a random matrix, see Section 3 page 404 in Stewart (1980).
simOrtho
returns a real matrix of size d
times d
.
Korbinian Strimmer (https://strimmerlab.github.io).
G.W. Stewart. 1980. The efficient generation of random orthogonal matrices with an application to condition estimators. SIAM J. Numer. Anal. 17:403-409. <DOI:10.1137/0717034>
# load whitening library
library("whitening")
# simulate random orthogonal matrix
Q = simOrtho(4) # matrix of dimension 4x4
Q
zapsmall( crossprod(Q) )
zapsmall( tcrossprod(Q) )