I am trying to do some OpenGL programming in haskell. But i am confused by the current state of the libraries. OpenGL uses the Tensor package which only defines several vector types (but doesn't do so in a generic way). It doesn't seem to provide any Matrix implementations.
There are several other packages for linear algebra: tensor (note the lowercase T), Vec, hmatrix which seem to be more complete than Tensor.
What i am searching for should at least contain common functions used in 3d and 2d graphics, have reasonable performance and should be compatible with OpenGL but i guess i'll have to change the library for that.
Late answer, sorry. HMatrix is the standard choice for things like this. It's very compatible, has a nice API, and is actually used for computer vision among other applications: http://dis.um.es/profesores/alberto/research.html
I was wondering the same recently, and was especially annoyed that Tensor doesn't provide you with convenient functions for dot product, cross product, normalization etc.
As you pointed out, vect
is "hardcoded" for Float
and Double
, and therfore cannot have useful typeclass instances like Functor
, Monoid
or Applicative
- with those we would get a lot of operations "for free", e.g. addition: (+) <$> v1 <*> v2
.
On #haskell
, I was pointed to the linear package. It is well-maintained and comes with a bunch of useful instances and functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With