block_diagonal | R Documentation |
Combine a list of matrices into a block diagonal matrix
block_diagonal(mat_list, fill = 0)
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 |
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.
A block-diagonal matrix
expand_matrix
Other matrix operations:
expand_matrix()
## Not run: block_diagonal(diag(1, 2), diag(1, 3)) #~ this is identical to `diag(1, 5)` ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.