drift.util.blockla

Functions

multiply_dm_dm(matrix1, matrix2)

Multiply a block diagonal matrix by another diagonal matrix.

multiply_dm_v(matrix, vector[, conj])

Multiply a block diagonal matrix by a blocked vector.

pinv_dm(matrix, *args, **kwargs)

Construct the pseudo-inverse of a block diagonal matrix.

svd_dm(matrix[, full_matrices])

Perform the SVD of a block diagonal matrix.

drift.util.blockla.multiply_dm_dm(matrix1, matrix2)

Multiply a block diagonal matrix by another diagonal matrix.

Parameters:
  • matrix1 ((nblocks, n, m) np.ndarray) – An array containing nblocks diagonal blocks of size (n, m).

  • matrix2 ((nblocks, m, k) np.ndarray) – An array containing nblocks diagonal blocks of size (m, k).

Returns:

nmatrix – An array containing nblocks diagonal blocks of size (n, k).

Return type:

(nblocks, n, k) np.ndarray

drift.util.blockla.multiply_dm_v(matrix, vector, conj=False)

Multiply a block diagonal matrix by a blocked vector.

Parameters:
  • matrix ((nblocks, n, m) np.ndarray) – An array containing nblocks diagonal blocks of size (n, m).

  • vector ((nblocks, m) np.ndarray) – An array containing the blocks of the vector, each of length m.

  • conj (boolean, optional) – Whether to multiply by the Hermitian conjugate of the matrix.

Returns:

newvector – An array containing the blocks of the vector, each of length n.

Return type:

(nblocks, n) np.ndarray

drift.util.blockla.pinv_dm(matrix, *args, **kwargs)

Construct the pseudo-inverse of a block diagonal matrix.

Parameters:

matrix ((nblocks, n, m) np.ndarray) – An array containing nblocks diagonal blocks of size (n, m).

Returns:

pinv_matrix – An array containing the pseudo-inverse.

Return type:

(nblocks, m, n) np.ndarray

drift.util.blockla.svd_dm(matrix, full_matrices=True)

Perform the SVD of a block diagonal matrix.

Parameters:
  • matrix ((nblocks, n, m) np.ndarray) – A array containing nblocks diagonal blocks of size (n, m).

  • full_matrices (boolean) – Whether to return the full size SVD matrices, or truncate. See documentation for scipy.linalg.svd

Returns:

  • u ((nblocks, n, k1) np.ndarray) – The left eigenvectors in block form. k1 is n if full_matrices is set, otherwise k1 = min(n, m)

  • sig ((nblocks, k) np.ndarray) – The singular values in block form, k = min(n, m)

  • v ((nblocks, k2, m) np.ndarray) – The right eigenvectors in block form. k2 is m if full_matrices is set, otherwise k2 = min(n, m)