block_diagonal: Create a block diagonal matrix

View source: R/mat-fcns.R

block_diagonalR Documentation

Create a block diagonal matrix

Description

Combine a list of matrices into a block diagonal matrix

Usage

block_diagonal(mat_list, fill = 0)

Arguments

mat_list

The list of matrices in the order they appear from top-right to bottom-left in the final matrix

fill

The value of entries in the off-block entries; defaults to 0

Details

The matrices provided in mat_list will be arranged as block matrices with the first listed matrix at the top-right and the last matrix at the bottom left. The entries that are not in each block are filled with fill, which defaults to 0.

Value

A block-diagonal matrix

See Also

expand_matrix

Other matrix operations: expand_matrix()

Examples

## Not run: 
block_diagonal(diag(1, 2), diag(1, 3)) #~ this is identical to `diag(1, 5)`

## End(Not run)

omkarakatta/ivqr documentation built on Aug. 20, 2022, 11:04 p.m.