Learn R Programming

whitening (version 1.4.0)

simOrtho: Simulate Random Orthogonal Matrix

Description

simOrtho generates a random orthogonal matrix.

Usage

simOrtho(d, nonNegDiag = FALSE)

Arguments

d

The dimension of the orthogonal matrix.

nonNegDiag

force the elements on the diagonal to be nonnegative (default: FALSE).

Value

simOrtho returns a real matrix of size \(d\) times \(d\).

Details

The algorithm is based on QR decomposition of a random matrix, see Section 3 page 404 in Stewart (1980).

References

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>

See Also

whiteningMatrix

Examples

Run this code
# NOT RUN {
# load whitening library
library("whitening")

# simulate random orthogonal matrix
Q = simOrtho(4) # matrix of dimension 4x4
Q

zapsmall( crossprod(Q) )
zapsmall( tcrossprod(Q) )


# }

Run the code above in your browser using DataLab