LAPACK
LAPACK
Hi,
i am trying to use the QR decomposition from the LAPACK library. Its ok syntax wise but when i try to build/compile it the following error(s) pop up. please help
THE CODE:
Modelica.Blocks.Interfaces.RealInput errorsample ;
Modelica.Blocks.Interfaces.RealInput errorsample2 ;
Modelica.Blocks.Interfaces.RealOutput pcon ;
import Modelica.Math.Matrices;
Real A[3,2]; Real b[3];
Real Q [3,2]; Real QT [2,3]; Real R [2,2];
Real gammalyp[2](start=1.0, start=1.0);
Integer i(start=0);
Real pcon1,pcon2,pcon3,pcon4;
Real errsamp0,errsamp1,errsamp2,errsamp3;
parameter Real gamma=10;
parameter Real stime=0.1;
algorithm
when sample(0, stime) then
i:=i + 1;
if noEvent(i >= 4) then
A:=[pcon1,1;pcon2,1;pcon3,1];
b:={errsamp1,errsamp2,errsamp3};
(Q,R):=Matrices.QR(A);
QT:=transpose(Q);
gammalyp:=Matrices.solve(R, QT*b);
Error: Error building simulator. Buildlog: command mingw-g++ not found.
Error: Error building simulator. Buildlog: command "C:\Program Files (x86)\Wolfram Research\SystemModeler 3.0.2\bin\../bin/Compile" not found.
g++ -m32 -mthreads -o sme_1395034709_6334.exe sme_1395034709_6334.cpp -I"." -I"C:\Program Files (x86)\Wolfram Research\SystemModeler 3.0.2\bin\../include/" -I"E:/Modelica/Paper 3" -L"." -L"C:\Program Files (x86)\Wolfram Research\SystemModeler 3.0.2\bin\../lib/" -L"E:/Modelica/Paper 3" -lLapack -lsim -lsuperlu_3.0 -lc_runtime -lmmcom -lf2c -lc_common -lexpat -lsundials_cvodes -lsundials_kinsol -lsundials_nvecserial -lwinmm -lwsock32
In file included from sme_1395034709_6334.cpp:12:
sme_1395034709_6334_functions.cpp: In function `int in_Modelica_Math_Matrices_LAPACK_dorgqr(type_description*, type_description*)':
sme_1395034709_6334_functions.cpp:128: error: expected initializer before '.' token
sme_1395034709_6334_functions.cpp:148: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_10'
sme_1395034709_6334_functions.cpp:151: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_10'
sme_1395034709_6334_functions.cpp: In function `Modelica_Math_Matrices_LAPACK_dorgqr_rettype _Modelica_Math_Matrices_LAPACK_dorgqr(real_array, real_array)':
sme_1395034709_6334_functions.cpp:175: error: expected initializer before '.' token
sme_1395034709_6334_functions.cpp:193: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_12'
sme_1395034709_6334_functions.cpp:196: error: 'struct Modelica_Math_Matrices_LAPACK_dorgqr_rettype' has no member named 'targ1_size_12'
mingw32-make: *** [noclean] Error 1
error: No executable generated.C:/Users/Dell/AppData/Local/Temp/sme_1395034709_6334.exe
Re: LAPACK
I created a more complete example, which works fine (at least compiles fine) in current omc. The Wolfram backend and code generation is different from the omc one though. You should try contacting them.
Code:
model M
import Modelica.Math.Matrices;
Real A[3,2]; Real b[3];
Real Q [3,2]; Real QT [2,3]; Real R [2,2];
Real gammalyp[2](each start=1.0);
Integer i(start=0);
parameter Real stime = 0.2;
Real pcon1 = 1;
Real pcon2 = 1;
Real pcon3 = 1;
Real errsamp1 = 1;
Real errsamp2 = 1;
Real errsamp3 = 1;
algorithm
when sample(0, stime) then
i:=i + 1;
if noEvent(i >= 4) then
A:=[pcon1,1;pcon2,1;pcon3,1];
b:={errsamp1,errsamp2,errsamp3};
(Q,R):=Matrices.QR(A);
QT:=transpose(Q);
gammalyp:=Matrices.solve(R, QT*b);
end if;
end when;
end M;
- sjoelund.se
- 1700 Posts
Re: LAPACK
It should be enough to post the model and say that code generation for Modelica.Math.Matrices.LAPACK.dorgqr is broken in WSM, but working in omc.
- sjoelund.se
- 1700 Posts