R/RandRot.R

Defines functions RandRot

#' @importFrom stats rnorm

RandRot <-
  function(p) {
    # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    # Samples a p x p uniformly random rotation matrix via QR decomposition
    # of a matrix with elements sampled iid from a standard normal distribution
    # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    RotMat <- qr.Q(qr(matrix(stats::rnorm(p^2), p, p)))
    return(RotMat)
  }

Try the rerf package in your browser

Any scripts or data that you put into this service are public.

rerf documentation built on May 2, 2019, 8:16 a.m.