Tuesday, August 14, 2012

On Blas and Hmatrix

So one thing I've been up to is sorting out how to help Haskell have working BSD3 licensed lin alg tools on hackage right now™. There are two packages on hackage that have all the basic algorithmic batteries presently!

Heres their names, whats good/bad about them, and what i've done to help improve things :)

Blas: bsd3, and has bindings to a whole bunch of blas, with support for banded matrices etc. Not currently maintained and the current hackage version wont build. I spoke with the author last week and he is no longer maintaining it, and pointed out that it does have a few problems in terms of api aesthetics etc.

I have a buildable version that you can use on my github here: https://github.com/cartazio/hs-linear-algebra. There were a bunch of little things that needed to be fixed up so it'd build. (but now it does!)

If someone is interested in taking over maintainer ship and cleaning up the api a bit plus updating the test suite code to use more modern unit test, and tracking down why 5 pieces of code in the test suite fail on certain instances in the complex double case. Also: only supports Doubles and Complex Doubles presently (which is fine, but seems like a needless restriction / overhead for folks who don't need as much precision in their computation)

Has a nice api, but because GSL is tightly woven into some of the vector code, which means the entire package,  even the linear algebra parts, is GPL licensed, which is viewed as problematical by the community.
I've had some conversations with the maintainer Alberto (super nice guy), and if the blas/lapack/vector stuff can be factored out and no longer use the GSL code, he's open to refactoring the core hmatrix package into the lin alg part ("hmatrix-base") and a part with the gsl code ("some other name").
(edit for clarity: the goal here being that hmatrix-base would be made bsd3)

So right now I'm midway through a slash and burn rewrite of what i hope will become the "hmatrix-base" piece, in branch towardsBSD3 at my repo https://github.com/cartazio/hmatrix. One handy thing about getting the Blas package in working shape is that I actually can (hopefully) repurpose some of its vector c code for this. So for now I have a copy of the various C code bits from the hs-linear-algebra in the same subdir as the offending code.

Basically the main piece of code that'll need to be changed is the code in
hmatrix / lib / Numeric / BSD/ Vector-aux.c  , perhaps using the cbits code from blas as the starting point? (though it'll need to extended to Float and Complex Float cases). Basically i'm doing a hack and slash job in a branch, and then i'll do surgery merge / refactor later and then talk with Alberto about moving things along license wise etc.

Thats not all I'm up to, but its all I can share right now :)

No comments:

Post a Comment