R/correlatedRNG.R

Defines functions corrnorm2 corrnorm

corrnorm <- function(C, n) {
  U <- chol(C)
  nC <- dim(C)[1]
  N <- (n %% nC) + n
  result <- array(rnorm(N), dim=c(N/nC,nC)) %*% U
  return(invisible(result[1:n]))
}

corrnorm2 <- function(C, n) {
  U <- chol(C)
  nC <- dim(C)[1]
  N <- (n %% nC) + n
  result <- array(rnorm(N), dim=c(N/nC,nC)) %*% U
  return(invisible(result))
}

Try the hadron package in your browser

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

hadron documentation built on Sept. 9, 2022, 5:06 p.m.