Search code examples
c++qtlinear-algebraeigen

Eigen vs QGenericMatrix


I'm developing a Qt C++ application and I need to do some linear algebra operations and store 2D and 3D matrix data. Maybe the N-dimensional case will be necessary too.

I saw that Qt have the QGenericMatrix class (link).

So, are there any advantages to include Eigen (link) in my project and use it instead of QGenericMatrix?


Solution

  • It's really hard to answer your question accurately without more information. If I were you, I would take the decision based on the requirements of the project.

    Just apply the KISS rule i.e., Keep it simple stupid.

    If your project needs to do complex numerical methods and linear algebra, Eigen would be a better choice. Otherwise you can just use QGenericMatrix or subclass it according to your needs.

    It might be important to note that Eigen doesn't have any dependencies other than the C++ standard library and it is cross platform. So, using it probably won't cause any issues if you are targeting multiple platforms.