R/Rmat.R

Defines functions Rmat

Documented in Rmat

#' @title Generate one Random Rotation matrix via QR
#' @export

Rmat = function(p){
  Q=gramschmidt(matrix(rnorm(p^2),nrow=p))$Q
  if(det(Q)<0){idx=sample(1:p,2);Q[c(idx[1],idx[2]),]=Q[c(idx[2],idx[1]),]}
  return(Q)
}
DongyueXie/bCART documentation built on Feb. 4, 2020, 12:26 a.m.