Function navtk::block_diag(std::initializer_list<Matrix>)

Function Documentation

Matrix navtk::block_diag(std::initializer_list<Matrix> matrices)

Create a block-diagonal matrix from the provided matrices.

Given square matrix inputs A, B and C, the output will have these arrays arranged along the diagonal:

{{A, 0, 0},
 {0, B, 0},
 {0, 0, C}}

Vectors are assumed to be horizontal matrices (single-row), matching the behavior of scipy.linalg.block_diag.

Parameters

matrices – A series of matrices to be arranged.

Returns

A single matrix containing the input matrices arranged diagonally, such that the index of the top-left of a given matrix is (1, 1) plus the index of the bottom-right of the preceding matrix.