Is there any classes or structures that can make matrix operation in C++ more handy?
I am writting a program in Visual Studio using MFC dialog based application. I have 5 matrix in my program where I have to add two of them and multiply other 2 of them and then subtract the result of multiplication from the summed value to get the 5th matrix. Some time I have to square the summed matrix also so it is quite laborious to write the full code... So one way is to write the code straight forward in C++ using array...But if I want to multiply two matrices or sum them directly as can be done in MatLab, is it possible in C++? If yes then how?开发者_开发问答
Boost has a good library for linear algebra: Boost.uBLAS.
It includes a convenient matrix class, as well as built in matrix arithmetic operations.
Eigen is very powerful and highly optimized. It supports both dynamic matrices (size unknown at compile time) and statically sized matrices. Take a look at the tutorial.
What's a good C++ library for matrix operations
I recommend the gmtl (generic math template library).
精彩评论