The OSQP documentation indicates that there is a shortcut syntax for updating the whole of the A or P matrices when using embedded code generation features (see here), but attempting to do so causes Matlab to crash.
Example:
%run OSQP codegen on a minimal problem
P = speye(2);
q = ones(2,1);
A = speye(2);
l = -ones(2,1);
u = ones(2,1);
m = osqp;
m.setup(P,q,A,l,u);
%run codegen, solve once
%m.codegen('osqp_codegen','parameters','matrices');
[x,y,st,iter,run_time] = emosqp('solve');
%updating A all at once causes a crash
A = A.*2;
[~,~,Ax] = find(A);
%emosqp('update_A',Ax,[],0); %crashes
emosqp('update_A',Ax,1:nnz(A),nnz(A)); %works
%updating P all at once causes a crash
P = P.*2;
[~,~,Px] = find(P);
%emosqp('update_P',Px,[],0); %crashes
emosqp('update_P',Px,1:nnz(P),nnz(P)); %works
The OSQP documentation indicates that there is a shortcut syntax for updating the whole of the A or P matrices when using embedded code generation features (see here), but attempting to do so causes Matlab to crash.
Example:
This issue relates also to #30.