[Haskell-cafe] Re: Linear algebra library for game programming.
karczma
karczma at info.unicaen.fr
Sun Nov 7 15:17:37 EST 2004
Serguey Zefirov writes:
>
> Right now I explore the possibilities of building the prototype
> for game physics library in Haskell.
>
> One of intermediate steps is to build linear algebra library for
> further utilisation. But, here I face some difficulties.
...
> In Haskell I should define different operators, something like `v3mulm3x3`,
> `v3mulm3x4`. This is somewhat inconvenient, given that I expect to utilize
> Vec2,3,4 and Mat(3,4)x(3,4) parametrized by Double and Float.
>
> So the question is: what other people do in situation like this and is there
> any paper(s) on linear algebra library design?
Perhaps think more, in a *detailed* way on all mathematical objects you
shall use, and find common parameterizations.
Will you use lists or arrays?
Do you need to separate the vector types with different dimensions?
(Note that if they are lists, summing them or computing scalar products
thereof will require some folds / zips /maps without ever using "N").
Then, design the appropriate general classes and overload your math.
Index-less, list-based linear algebra packages have been constructed
a few times. There is CLAS of Thorsten Zoerner, in Clean - a language
similar to Haskell.
See HBlas of Hal Daume for Haskell. (But you will need CLAPACK; this
is a serious, optimized stuff).
Do you need an elegant toy, or a fast number cruncher?
Jerzy Karczmarczuk
More information about the Haskell-Cafe
mailing list