matrix.block_diag {adelie}R Documentation

Creates a block-diagonal matrix.

Description

Creates a block-diagonal matrix.

Usage

matrix.block_diag(mats, n_threads = 1)

Arguments

mats

List of matrices.

n_threads

Number of threads.

Value

Block-diagonal matrix.

Examples

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)

[Package adelie version 1.0.1 Index]