S-function and lapack

2 ビュー (過去 30 日間)
Alex Gimondi
Alex Gimondi 2020 年 10 月 16 日
編集済み: Alex Gimondi 2020 年 10 月 16 日
Hello,
I'm trying to implemet a S-function that does the weighted-least quare control allocation (WLS).
The files provided contain a mex function implementation of the method, the only thing that I did is to change the int type in wlsc_alloc to mwSignedIndex to prevent compatibility issues (just compiling the code of the toolbox and use it was making my MATLAB crash).
Now I want to use that code in S-function.
I set up my problem but when I'm calling a function of lapack MATLAB crashes again.
Since I'm quite new to S-function and mex compilation can you help me to find out the problem.
I'll paste a snippet of the code:
k,m,ione=1 are mwSignedIndex
u,W,iter are double*
k=1;
m=1;
/* Allocate space for output variables */
mxArray *u_out = mxCreateDoubleMatrix(m, 1, mxREAL);
mxArray *W_out = mxCreateDoubleMatrix(m, 1, mxREAL);
mxArray *iter_out = mxCreateDoubleMatrix(1, 1, mxREAL);
/* Create pointers to output variables */
u = mxGetPr(u_out);
W = mxGetPr(W_out);
iter = mxGetPr(iter_out);
/* Copy initial values of u and W */
DCOPY(&m,u0,&ione,u,&ione); /* u = u0 */
Thank you,
Alex

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by