runlmc.linalg.block_diag module

class runlmc.linalg.block_diag.BlockDiag(blocks)[source]

Bases: runlmc.linalg.matrix.Matrix

Creates a block diagonal matrix from constintuent, possibly rectangular internal ones. Note this is PSD if its constintuents are.

For constituents \(K_i\), this matrix corresponds to the direct sum \(K = \bigoplus_i K_i\).

Parameters:blocks – blocks with which to construct the block diagonal matrix.
as_numpy()[source]
Returns:numpy matrix equivalent, as a 2D numpy.ndarray
matvec(x)[source]

Multiply a vector \(\textbf{x}\) by this matrix, \(K\), yielding \(K\textbf{x}\).

Parameters:x – a one-dimensional numpy array of the same size as this matrix
Returns:the matrix-vector product