danshapero / sigma

Fortran 2003 library for sparse matrix algebra
34 stars 7 forks source link

Support for more general datatypes #1

Open poulson opened 9 years ago

poulson commented 9 years ago

It appears that sigma always assumes double-precision real data. Are there plans to support, for example, complex data? (Support for double-double and/or quad-precision would also be very useful.)

danshapero commented 9 years ago

Hi Jack, thanks for taking a look! While it would be very useful to include more general data types, C++ will always beat Fortran on this point via template meta-programming. In order to implement this for sigma, one would have to systematically replace all of the real variable declarations with SCALAR, then generate the real and complex versions of the library code by replacing all instances of SCALAR in the template source code. This is the approach taken in PSBLAS.

I'm more inclined to prioritize developing distributed matrix data structures using the co-array features of Fortran 2008. I haven't seen many libraries take advantage of this yet.

poulson commented 9 years ago

Does Fortran 2003 not support templating? http://fortranwiki.org/fortran/show/Generic+programming

I think that support for more general datatypes would be very beneficial for adoption, but I'm biased as I always try to support complex data.