UCL-ARC / householder

A native Rust library for advanced Linear Algebra routines
https://docs.rs/householder/latest/householder/
Apache License 2.0
22 stars 4 forks source link

Single node sparse matrix structures #12

Open tbetcke opened 2 years ago

tbetcke commented 2 years ago

Implement CSR sparse matrix structures on a single node.

The following features should be available:

jedbrown commented 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.

tbetcke commented 2 years ago

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.

jedbrown commented 2 years ago

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.