Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open source C++ library for vector mathematics

Tags:

c++

math

I would need some basic vector mathematics constructs in an application. Dot product, cross product. Finding the intersection of lines, that kind of stuff.

I can do this by myself (in fact, have already) but isn't there a "standard" to use so bugs and possible optimizations would not be on me?

Boost does not have it. Their mathematics part is about statistical functions, as far as I was able to see.

Addendum:

Boost 1.37 indeed seems to have this. They also gracefully introduce a number of other solutions at the field, and why they still went and did their own. I like that.

like image 619
akauppi Avatar asked Dec 12 '08 14:12

akauppi


4 Answers

Re-check that ol'good friend of C++ programmers called Boost. It has a linear algebra package that may well suits your needs.

like image 108
PW. Avatar answered Oct 18 '22 02:10

PW.


I've not tested it, but the C++ eigen library is becoming increasingly more popular these days. According to them, they are on par with the fastest libraries around there and their API looks quite neat to me.

like image 23
Johannes Schaub - litb Avatar answered Oct 18 '22 02:10

Johannes Schaub - litb


Armadillo

Armadillo employs a delayed evaluation approach to combine several operations into one and reduce (or eliminate) the need for temporaries. Where applicable, the order of operations is optimised. Delayed evaluation and optimisation are achieved through recursive templates and template meta-programming.

While chained operations such as addition, subtraction and multiplication (matrix and element-wise) are the primary targets for speed-up opportunities, other operations, such as manipulation of submatrices, can also be optimised. Care was taken to maintain efficiency for both "small" and "big" matrices.

like image 5
Özgür Avatar answered Oct 18 '22 03:10

Özgür


I would stay away from using NRC code for anything other than learning the concepts.

I think what you are looking for is Blitz++

like image 2
Scott Avatar answered Oct 18 '22 03:10

Scott