bwall bwall - 11 months ago 55
C++ Question

Are there efficient Matrix LIbraries in C++?


At work, I use Matlab to code. For a long time we were using for loops for a bunch of code, which is notoriously slow in matlab. Then I took a linear algebra class, got comfortable with matrices, and vectorized our code. It went from taking over an hour to taking less than two minutes to run! Ever since then, I've loved finding ways to make code use matrices to run faster. I've even got matrix math down in python's numpy.


Talking with teachers, I've discovered that Matlab was based on some matrix optimization libraries commissioned by the US government. Does this mean that there are some government C/C++/C# libraries out there that enable super efficient matrix operations? What do I #include to get them into Visual Studio?

Answer Source

A possible answer could be glm. In visual studio you can easily get it by going to tools->nuget package manager->package manager console, then typing: install-package glm and hit enter.

The glm specializes on GPU/OpenGL related problems, which are mostly matrix calculations. I assume its considered the goto standard.

#include <glm\glm.hpp>

will add it to your project, but thats just one out of many specialized headers in the collection. Some are for matrices, others for vectors, directions, lengths etc, which has what function is documented on that page.