views:

187

answers:

3

I'm looking for POD low dimension vectors (2,3 and 4D let say) with all the necessary arithmetic niceties (operator +, - and so on). POD low dimension matrices would be great as well.

boost::ublas vectors are not POD, there's a pointer indirection somewhere (vector are resizeable).

Can I find that anywhere in boost? Using boost::array along with boost.operator lib is an options but maybe I'm missing something easier elsewhere?

Apart boost, does anybody know any good library around?

PS: POD <=> plain old data

EDIT:

Otherwise, here are some other links I gathered from another thread:

+3  A: 

The blitz++ TinyMatrix / TinyVector is what you want I think,

you also have the libeigen.

fa.
yes indeed, nice code, dimensions are "templated". Still, it's a bit dry with 3D specific features like getting euler angles, inverting a matrix...
Definitely, eigen rocks them all :P
Johannes Schaub - litb
A: 

There is a nice Vector library for 3d graphics in the prophecy SDK:

Check out http://www.twilight3d.com/downloads.html

Laserallan
Is it easy to extract from the rest of the SDK?
If I remember correctly it's a header only library that only depends on a few standard c++ headers so it should be trivial to extract.
Laserallan
it is trivial indeed. light-weight, full-featured. I might go for it.
Glad you liked it. Checked it out again and I must say I think it's an amazing piece of C++.
Laserallan
A: 

Have you looked at STL's valarray container?

Checkout this answer to a related SO question: http://stackoverflow.com/questions/152745/optimising-c-2-d-arrays

ceretullis