chessai / eigen

Haskell bindings to the Eigen C++ library
Other
16 stars 6 forks source link

Sparse matrices whose size is not known at compile time #20

Open Ehtycs opened 4 years ago

Ehtycs commented 4 years ago

Hi,

I've been looking for a suitable linear algebra package to be used in a finite element solver I'm writing just for fun, and this package looks very nice. The only thing is that I can't figure out how to work with large sparse equation systems emerging from FEM whose size can't be known at compile time. Is it somehow possible?

I'm a mediocre haskeller and haven't used type literals or many of the extensions used in the code. I tried to look around the code. It seems that there are quite many KnownNat constraints in many of the functions although the C-interface layer could also work with dynamically sized matrices.

alpmestan commented 3 years ago

You'd have to use something like Data.Reflection.reifyNat, to turn your runtime size into a type-level natural, at least within a scope.