Learn R Programming

bootSVD (version 1.1)

genQ: Generate random orthonormal matrix

Description

genQ generates a square matrix of random normal noise, and then takes the QR decomposition to return Q, a random orthogonal square matrix.

Usage

genQ(n, lim_attempts = 200)

Arguments

n

the dimension of the desired random orthonormal matrix

lim_attempts

the random matrix of normal noise must be full rank to generate the appropriate QR decomposition. lim_attempts gives the maximum number of attempts for generating a full rank matrix of normal noise.

Value

a random orthonormal (\(n\) by \(n\)) matrix

Examples

Run this code
# NOT RUN {
A<-genQ(3)
round(crossprod(A),digits=10)
# }

Run the code above in your browser using DataLab