[Haskell-cafe] Vector/matrix arithmetic

James McNeill jamesm at suckerpunch.com
Wed Nov 2 13:32:07 EST 2005

I'm attempting to learn Haskell by writing some orbital mechanics code.  I'd
like to use vector and matrix arithmetic to simplify it.  The Haskell book
I've got, Simon Thompson's "Haskell: The Craft of Functional Programming,"
has one approach, which is to alias a list of numbers to Vector, and a list
of vectors to Matrix, and then define functions to perform inner and outer
products (dot/cross products) and so forth.


On http://haskell.org/hawiki/FunDeps another approach is sketched out that
looks far more appealing to me. This is to create Vector and Matrix types
that can use overloaded arithmetic operators. It uses functional
dependencies, and the resulting syntax looks a lot like what you can do
using C++ or Matlab.


I don't know enough Haskell to finish out the code that is started there,
and I haven't been able to find any vector/matrix libraries for Haskell that
look like this.  I did find a port of a linear algebra library (BLAS) to
Haskell, but it looked like it did everything in imperative style.
Performance is not a major concern for me at this point so I'd prefer to do
things functionally.


Does anyone know what the best way to do vector/matrix arithmetic in Haskell
might be?  I don't need arbitrary dimension; all my work will be confined to
2D and 3D space.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20051102/9a872afd/attachment-0001.htm

More information about the Haskell-Cafe mailing list