Lnear algebra library for game programming.

Right now I explore the possibilities of building the prototype for game physics library in Haskell. This is a purely hobby approach to gain more knowledge on Haskell and library design in general. One of intermediate steps is to build linear algebra library for further utilisation. But, here I face some difficulties. In C++ I could define needed operators on per-type basis, and define universal operators for, say, Vec3 * Mat3x3, Vec3 * Mat3x4, etc. 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? -- Yours truly, Serguey Zefirov, theszATmail.ru.

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

Will you use lists or arrays?
No, not arrays. I use Haskell from time to time for about three or four years and had succeed not to learn any of array operations at all. That amuses me more than anything else.
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).
Thank you for pointers.
Do you need an elegant toy, or a fast number cruncher?
Elegant and fast enough toy for number crunching. ;) I hope I could use some of techniques from your papers (Generating power of lazy semantics, for example) in this toy, if I succeed. -- Yours truly, Serguey Zefirov, theszATmail.ru.

At 22:52 07/11/04 +0300, Serguey Zefirov wrote:
So the question is: what other people do in situation like this and is there any paper(s) on linear algebra library design?
This response has absolutely nothing to do with Haskell, and not really anything to do with library design... Several years ago, when programming a system for 3D analysis from 2D camera data (a form of "terrestrial photogrammetry), I found this to be a most helpful reference work: Handbook for Automatic Computation, Volume II - Linear Algebra J.H. Wilkinson, C Reinsch Springer-Verlag, ISBN 3-540-05414-6, 1971 (!) It addresses a number of tricky computational topics in Linear Algebra, with what I found to be an excellent balance of theoretical background and practical engineering concerns. I'm not a student of numerical techniques, so I don't know whether this is now somewhat dated; indeed, I've no idea if it's still available, though I'd expect any decent technical library to have a (maybe dusty) copy somewhere. #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

On Sun, 7 Nov 2004, Serguey Zefirov wrote:
So the question is: what other people do in situation like this and is there any paper(s) on linear algebra library design?
found at: http://haskell.org/libraries/#numerics http://web.archive.org/web/*/http://www.numeric-quest.com/haskell/Orthogonal... which is literal Haskell Linear algebra functions are also included in: http://haskelldsp.sourceforge.net/
participants (4)
-
Graham Klyne
-
Henning Thielemann
-
karczma
-
Serguey Zefirov