blockdiag: Block diagonal matrices

Description Usage Arguments Value Note Author(s) Examples

View source: R/mixstock.R

Description

Construct a block-diagonal matrix from a list of submatrices.

Usage

1

Arguments

...

a comma-separated list of matrix objects that will form the submatrices of the block-diagonal matrix.

Value

A block-diagonal matrix with dimensions equal to the sum of the dimensions of the submatrices.

Note

If you want to use a previously constructed list of matrices, use do.call (see the examples). Doesn't preserve names or attributes (yet).

Author(s)

Ben Bolker

Examples

1
2
3
4
5
6
  m1 <- matrix(1,nrow=2,ncol=2)
  m2 <- matrix(2,nrow=1,ncol=3)
  m3 <- matrix(3,nrow=3,ncol=2)
  blockdiag(m1,m2,m3)
  l <- list(m1,m2,m3)
  do.call("blockdiag",l)

mixstock documentation built on May 2, 2019, 6:48 p.m.