I would like to use Smatrix to invert matrix.
But, it seems that i cannot define dynamically the size of the matrix?
Is it right?
How can do that?

Moreover, the size of my matrix can go up to 400*400?
Does Smatrix the right tool to do that?
if not, can you point me to other tools?

Thanks for your help,


To give more detail :

l164 : SMatrix SMatrixU;

output of the compilation :

…/Code/IntercalibrationDjama.cpp: In member function virtual void IntercalibrationDjama::FitAlpha(bool)': ../Code/IntercalibrationDjama.cpp:164: non-constantnregion’ cannot be used as
template argument
…/Code/IntercalibrationDjama.cpp:164: non-constant nregion' cannot be used as template argument ../Code/IntercalibrationDjama.cpp:164: template argument 4 is invalid ../Code/IntercalibrationDjama.cpp:164: ISO C++ forbids declaration ofSMatrixU
’ with no type

Oups :
line 164 is in fact :
SMatrix<double , nregion , nregion > SMatrixU;

You cannot use SMatrix dynamically, the number of rows and number of columns are template arguments. And you cannot use as a template argument a variable. The template argument must be a constant quantity known at compile time, like a const int or an enumeration.

It is also not recommened for large size like 400x400, where you risk to have very large compilation times and very large size of your compiled code if you start doing operations (like multiplications or additions) with the matrices.

For a dynamic and medium-large size matrix, I would recommend you to use TMatrix.

Best Regards,