simOrtho: Simulate Random Orthogonal Matrix

View source: R/simOrtho.R

simOrthoR Documentation

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).

Details

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

Value

simOrtho returns a real matrix of size d times d.

Author(s)

Korbinian Strimmer (https://strimmerlab.github.io).

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

# load whitening library
library("whitening")

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

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



whitening documentation built on June 7, 2022, 5:10 p.m.