aspcore.matrices.block_diag_multiply

aspcore.matrices.block_diag_multiply(mat, block_left=None, block_right=None, out_matrix=None)

This function can easily be replaced by apply_blockwise.

Performs the operation block_diag_left @ mat @ block_diag_right, where block_diag is a matrix with multiple copies of block on the diagonal block_diag = I_b kron block

Parameters:
  • mat (ndarray of shape (ab, ab))

  • block_left (ndarray of shape (a, a), optional)

  • block_right (ndarray of shape (a, a), optional)

  • out_matrix (ndarray of shape (ab, ab), optional) – if provided, the result is written to this matrix

Returns:

  • out_matrix (ndarray of shape (ab, ab))

  • block_left is size (a, a)

  • block_right is size (a, a)

  • mat is size (ab, ab) for some integer b