adelie.matrix.block_diag#

adelie.matrix.block_diag(mats: list, *, method: str = 'naive', n_threads: int = 1)[source]#

Creates a block-diagonal matrix given by the list of matrices.

If mats represents a list of matrices \(A_1,\ldots, A_L\), then the resulting matrix represents the block-diagonal matrix given by

\[\begin{split}\begin{align*} A = \begin{bmatrix} A_1 & 0 & \cdots & 0 \\ 0 & A_2 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & A_L \end{bmatrix} \end{align*}\end{split}\]

Note

The routines for this matrix are faster when there are many small blocks rather than few large blocks.

Parameters:
matslist

List of matrices to represent the block diagonal matrix.

methodstr, optional

Method type. It must be one of the following:

  • "naive": naive matrix.

  • "cov": covariance matrix.

Default is "naive".

n_threadsint, optional

Number of threads. Default is 1.

Returns:
wrap

Wrapper matrix object.