Learn R Programming

rstiefel (version 1.0.1)

rustiefel: Siumlate a Uniformly Distributed Random Orthonormal Matrix

Description

Siumlate a random orthonormal matrix from the uniform distribution on the Stiefel manifold.

Usage

rustiefel(m, R)

Arguments

m

the length of each column vector.

R

the number of column vectors.

Value

an m*R orthonormal matrix.

References

Hoff(2007)

Examples

Run this code
# NOT RUN {
## The function is currently defined as
function (m, R) 
{
    X <- matrix(rnorm(m * R), m, R)
    tmp <- eigen(t(X) %*% X)
    X %*% (tmp$vec %*% sqrt(diag(1/tmp$val, nrow = R)) %*% t(tmp$vec))
  }

# }

Run the code above in your browser using DataLab