SparseMatrixFormat

class odl.core.sparse.sparse_template.SparseMatrixFormat(sparse_format: str, impl: str, constructor: Callable, is_of_this_sparse_format: Callable[[object], bool], to_dense: Callable, matmul_spmatrix_with_vector: Callable)[source]

Bases: object

Metainformation about Sparse Matrices in some storage format. This is a singleton class, it has a post-init method that registers the Sparse Matrix format in a global, internal dict (with [impl][format] key structure, for instance [‘scipy’][‘COO’])

Attributes

sparse_formatstr

The shorthand descriptor of the layout of the sparse matrix, e.g ‘COO’

implstr

The identifier of the backend, e.g ‘scipy’

constructorCallable

Constructor of the Sparse backend

is_of_this_sparse_formatCallable[[object], bool]

Checks whether an array is of the same backend and layout of the given SparseMatrixFormat

to_denseCallable

Makes a sparse matrix dense

matmul_spmatrix_with_vectorCallable

Sparse matrix multiplication function (the signature differs accross backends)

__init__(sparse_format: str, impl: str, constructor: Callable, is_of_this_sparse_format: Callable[[object], bool], to_dense: Callable, matmul_spmatrix_with_vector: Callable) None