aspcore.matrices

Functions for common operations on matrices.

Some examples include constructing a block matrix, ensure positive definiteness, applying a function to individual blocks of a block matrix.

References

Functions

apply_blockwise(mat, func, out_shape, *args)

Applies the same function to each block in the block matrix mat.

block_diag(arrays)

Creates a block diagonal matrix

block_diag_multiply(mat[, block_left, ...])

This function can easily be replaced by apply_blockwise.

block_of_toeplitz(block_of_col[, block_of_row])

Generates a block matrix of toeplitz blocks from a set of columns and rows The values in the last axis for each (m,n) block is turned into a toeplitz matrix.

block_transpose(matrix, block_size[, out])

Transposes each block individually in a block matrix.

broadcast_func(mat, func, *args[, ...])

Applies the same function to each matrix in the array

ensure_hermitian(mat[, overwrite_ok])

Symmetrizes mat if it is not already Hermitian

ensure_pos_def_adhoc(mat[, start_reg, verbose])

ensure_pos_semidef(mat)

Modifies mat to ensure it is positive semidefinite if it is not already.

is_hermitian(mat)

Returns true if mat is hermitian, false otherwise

is_hermitian_hardcoded(mat)

Deprecated, use is_hermitian instead

is_pos_def(mat)

Returns true if mat is positive definite, false otherwise

is_pos_semidef(mat)

Returns true if mat is positive semidefinite, false otherwise

lsq_with_l2_regularization(A, y[, lamb])

Solves a linear least squares problem with L2 regularization

to_length(ar, length[, axis])

Either truncates or pads ar at the end with zeros, so that the length along axis is equal to length.