Open tbetcke opened 2 years ago
Do you have a vision of the traits that would allow writing a function that is agnostic over whether its input matrices are sparse or dense? I see your traits like MatMul
are specialized on dense/strided storage.
I should rather call the MatMul trait a DenseMatMul trait. Still experimenting with traits for sparse matrices. But it will likely come down to something like the scipy operator interface, or more involved, the Trilinos Thyra interfaces.
SciPy LinearOperator
doesn't support sparse-sparse products, as in $P^T A P$ needed for multigrid. I think the same restriction applies to Thyra LinearOpBasi
.
PETSc has a dynamic multiple dispatch system for heterogeneous matrix-matrix operations, but it's based on strings and function pointers. In Rust, that would naturally use a HashMap
and Any::type_id
to locate the fully resolved implementation. I struggle to see how to avoid without creating a closed world. There is an open sum technique that might be useful, though it's hard for me to see how to use it effectively and I'm not sure it's better than the HashMap
.
Implement CSR sparse matrix structures on a single node.
The following features should be available: