#'function to generate random positive definite matrice
#'
#'@param n size of the matrix
#'
#'@export
posdefmat <- function(n, ev = runif(n, 0, 10))
{
Z <- matrix(ncol=n, rnorm(n^2))
decomp <- qr(Z)
Q <- qr.Q(decomp)
R <- qr.R(decomp)
d <- diag(R)
ph <- d / abs(d)
O <- Q %*% diag(ph)
Z <- t(O) %*% diag(ev) %*% O
return(Z)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.