Open
Description
Prior art in other languages:
- SciPy: https://docs.scipy.org/doc/scipy/reference/sparse.html
- Matlab: https://www.mathworks.com/help/matlab/ref/sparse.html
- Julia: https://docs.julialang.org/en/v1/stdlib/SparseArrays/index.html
In Fortran (I keep this list updated with all implementations posted in this issue):
- @certik: https://github.com/certik/hfsolver/blob/b4c50c1979fb7e468b1852b144ba756f5a51788d/src/sparse.f90
- @jvdp1: https://github.com/jvdp1/libsparse
- @sfilippone: https://github.com/sfilippone/psblas3
- @victorsndvg: https://github.com/fempar/fempar/tree/experimental/Sources/Lib/LinearAlgebra/SparseMatrix
- @danshapero: https://github.com/danshapero/sigma
- https://github.com/cp2k/dbcsr
- https://github.com/TRIBO-Pprime/MSOLV
- Yale sparse matrix package: http://www.netlib.no/netlib/ode/yale.f
I really like the SciPy simple non-OO implementation, and I have ported it to modern Fortran in the link above. If people also want an OO implementation, then it can be build on top as an option.
One thing that I found out is that one must sort the indices and the overall speed very much depends on how quickly one can sort it. I ended up using quicksort
, but it might be even faster to use some specialized sorting algorithm (such as Timsort) because in practice, the indices have subsections that are already sorted (typically coming from some local to global mapping as in finite elements), but overall it is not sorted.