Alexandre Kaspar
Alexandre Kaspar

Reputation: 564

C++ library for fixed-size matrices and vectors

I am looking for a C++ fixed-size matrix library which would implement most common operations for vectors and matrices in the same way as boost::numeric::ublas does, but to be used within CUDA kernels (and thus be fixed-size to use only local memory and not global memory accesses).

I found several host-based matrix libraries: boost::numeric::ublas, Eigen, blitz, but they do not have fixed-size matrices I could use with CUDA on my kernels. Eigen has Matrix3f and corresponding stuff which is what I am looking for, but it does not survive compilation with nvcc (though there seems to be some progress in that direction, see here ).

Edit: I'm doing all that stuff on Linux, and thus would like to possibly have something cross-platform...

Upvotes: 4

Views: 943

Answers (2)

Lufi
Lufi

Reputation: 161

What about XNA Math which is distributed with DirectX SDK? It contains special classes for vectors and matrices and tons of special functions for operations on them.

  • XMVECTOR
  • XMMATRIX
  • XMVectorMethodName
  • XMMatrixMethodName

Upvotes: 0

user1357649
user1357649

Reputation:

If you're looking for a popular C++ math library that has been shown to work really well, you can try glm for your purposes. It's modeled after GLSL, which means its data is stored in column-major order, which is friendly with all shader/gpu-oriented designs. GLM is a header-only library and purported to be very standards-friendly, so maybe it'll compile properly for you.

Upvotes: 3

Related Questions