inv_diag#

iskra.sparse.inv_diag(mat: SparseTensor) SparseTensor[SOURCE]#

Inverts elements of a diagonal COO matrix.

The function densifies the diagonal of a sparse matrix and divisions by the zero non-diagonal elements become NaNs. This default behavior is subject to change given a good real-world usecase that requires inverting only the non-zero elements: please leave an issue if you have one.

Parameters:

mat (SparseTensor) – Diagonal COO matrix.

Returns:

(SparseTensor) – COO matrix of the same shape, but with