S-function and lapack

2 vues (au cours des 30 derniers jours)
Alex Gimondi
Alex Gimondi le 16 Oct 2020
Modifié(e) : Alex Gimondi le 16 Oct 2020
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

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by