matrix.block_diag | R Documentation |
Creates a block-diagonal matrix.
matrix.block_diag(mats, n_threads = 1)
mats |
List of matrices. |
n_threads |
Number of threads. |
Block-diagonal matrix.
Trevor Hastie and James Yang
Maintainer: Trevor Hastie hastie@stanford.edu
n <- 100
ps <- c(10, 20, 30)
mats <- lapply(ps, function(p) {
X <- matrix(rnorm(n * p), n, p)
matrix.dense(t(X) %*% X, method="cov")
})
out <- matrix.block_diag(mats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.