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

blodiag

Block diagonal matrix


Description

Split a vector x into a block diagonal matrix.

Usage

blodiag(x, blo)

Arguments

x

A vector of length n.

blo

A vector of positive integers such that sum(blo) == n.

Value

A block-diagonal matrix with as many row as elements of blo and n columns. The vector x is split into length(blo) sub-vectors and these are the blocks of the resulting matrix.

Author(s)

Giovanni M. Marchetti

See Also

Examples

blodiag(1:10, blo = c(2, 3, 5)) 
blodiag(1:10, blo = c(3,4,0,1))

ggm

Graphical Markov Models with Mixed Graphs

v2.5
GPL-2
Authors
Giovanni M. Marchetti, Mathias Drton, Kayvan Sadeghi
Initial release
2020-02-014

We don't support your browser anymore

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