AlgLib: How to use RMatrixSolve in MQL5

 

I have a problem with setting input values for the AlgLib operation of RMatrixSolve.

Aspecially, I don't know how to fill Input matrix (type CMatrixDouble) with my values.

Hears a part of the code.

Globals:

double Res_1[4];
CMatrixDouble Mas_1(4,4);
const int N=3;
int info_LA;
CDenseSolverReportShell rep_LA;
double x_Sol[];

OnTick()

Res_1[0]=1;
Res_1[1]=1;
Res_1[2]=1;

Mas_1[0][0]=1;

...

Mas_1[2][2]=1;

calc.RMatrixSolve(Mas_1,N,Res_1,info_LA,rep_LA,x_Sol);

It gives me the Error:

'operator[]' - l-value required 
'=' - l-value required

Should have something to do, with the Datatype of CMatrixDouble

Would be really glad if somebody could help.

 

Please use the </> button to insert your code.


 
Eleni Anna Branou:

Please use the </> button to insert your code.


Thanks Eleni for your quick reaction, but fortunately I found the answer. Tried it for one day, and now, one minute after I posted my question, found the answer myself.

For arrays declared with CMatrixDouble the .Set funktion hast to be used
i.e:
Mas_1[Row].Set(Colum,Value);

But acutally I would like to raise the question, why I could not find appropriate documentation for the AlgLib library. The explanations within the sourcecode of alglib are quite basic, and not helpfull in practice. Whereas the docs on http://www.alglib.net/ are really heavy. But I must admit I'm not a Pro in C++, only worked with Python before.  

ALGLIB - C++/C# numerical analysis library
ALGLIB - C++/C# numerical analysis library
  • www.alglib.net
ALGLIB is a cross-platform numerical analysis and data processing library. It supports several programming languages (, , ) and several operating systems (Windows and POSIX, including Linux). ALGLIB features include: Data analysis (classification/regression, statistics) Optimization and nonlinear solvers Interpolation and linear/nonlinear...