1

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?

user543265
  • 129
  • 1
  • 1
  • 6

4 Answers4

3

Boost has a good library for linear algebra: Boost.uBLAS.

It includes a convenient matrix class, as well as built in matrix arithmetic operations.

Charles Salvia
  • 52,325
  • 13
  • 128
  • 140
  • uBLAS is indeed great and it is pretty easy to use it in conjunction with a LAPACK library, making it quite useful if you need to perform high-performance matrix computations. – James McNellis Jan 20 '11 at 07:22
0

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.

nimrodm
  • 23,081
  • 7
  • 58
  • 59
0

What's a good C++ library for matrix operations

Community
  • 1
  • 1
Shinnok
  • 6,279
  • 6
  • 31
  • 44
0

I recommend the gmtl (generic math template library).

beutelfuchs
  • 155
  • 1
  • 2
  • 7