lookup_sparse_format

odl.core.sparse.sparse_matrix.lookup_sparse_format(matrix: object) SparseMatrixFormat | None[source]

Looks up the sparse format of a matrix. Goes through the registered backends (scipy, pytorch…) and formats (COO, CSR…)

Args:

matrix (object): The matrix we want to get the sparse format of

Returns:

Optional[SparseMatrixFormat]: returns the sparse-format identifier if the matrix has one of the registered formats. Otherwise None.

Notes:

“sp_bkend” = sparse backend “sp_fmt” = sparse format