| matrix.block_diag | R Documentation | 
Creates a block-diagonal matrix.
matrix.block_diag(mats, method = c("naive", "cov"), n_threads = 1)
| mats | List of matrices. | 
| method | Method type, with  default  | 
| 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, method="cov")
mats <- lapply(ps, function(p) {
    X <- matrix(rnorm(n * p), n, p)
    matrix.dense(X, method="naive")
})
out <- matrix.block_diag(mats, method="naive")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.