Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

blkdiag

Block Diagonal Matrix


Description

Build a block diagonal matrix.

Usage

blkdiag(...)

Arguments

...

sequence of non-empty, numeric matrices

Details

Generate a block diagonal matrix from A, B, C, .... All the arguments must be numeric and non-empty matrices.

Value

a numeric matrix

Note

Vectors as input have to be converted to matrices before. Note that as.matrix(v) with v a vector will generate a column vector; use matrix(v, nrow=1) if a row vector is intended.

See Also

Examples

a1 <- matrix(c(1,2), 1)
a2 <- as.matrix(c(1,2))
blkdiag(a1, diag(1, 2, 2), a2)

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.