sparsemat / sprs

sparse linear algebra library for rust
Apache License 2.0
381 stars 45 forks source link

Linear solver interfaces #339

Open jlogan03 opened 9 months ago

jlogan03 commented 9 months ago

I have a rough working prototype of serial, sparse-sparse BiCGSTAB here and it's got me thinking about how to structure interfaces to solvers.

It seems like there are a few specific actions that users need regularly that might be supported in different ways by different kinds of solvers -

To that end, I'm thinking each solver should be associated with both

All pretty vanilla so far.

Now, there's a pretty different pattern of usage between direct and iterative solvers, and I can't think of a way to stuff them into the same trait. So with that, we'd have two traits, say, DirectSolver and IterativeSolver, guiding the implementation of the solver structs, and possibly another two guiding the implementation of the convenience functions.

This leaves us with

@mulimoen - I'm curious what your thoughts are on

mulimoen commented 9 months ago

The implementation of BiCGSTAB would be great to have in this crate.

On generalisation into traits I would hold on a bit until we know what to expect on differences between the solvers. Maybe each solver should return residuals or other temporaries? Is the input similar between solvers and how does preconditioners fit in? It would be great to see what functionality is common between the solvers before settling on some traits.

jlogan03 commented 9 months ago

Sounds good - I'll button that implementation up with my best guess at what an iterative solver interface might look like, but without encoding that interface in a trait just yet.