MATLAB: Are the sparse matrices converted to full matrices by ‘lsqlin’

MATLABOptimization Toolbox

I have some large sparse matrices (300000×100000) that I am attempting to pass to 'lsqlin'.
However, I receive the following errors:
Warning: Cannot use sparse matrices with active-set algorithm: converting to full.
> In lsqlin (line 368)
In example (line 5)
Error using full
Requested 261097×81168 (157.9GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a
long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in lsqlin (line 377)
x     qpsub(full(C),d,[full(Aeq);full(A)],[beq;b],lb,ub,X0,neqcstr, …
Here is my code:
options = optimoptions('lsqlin', 'Display', 'iter-detailed');
x = lsqlin(A,b,[],[],C,zeros(size(C,1),1),[],[],x0,options);
Here are my variables:
>> whos
Name Size Bytes Class Attributes
A 261097x81168 13254408 double sparse
C 76x81168 650568 double sparse
b 261097x1 14496 double sparse
x0 81168x1 262928 double sparse

Best Answer

Better support for sparse matrices was added in R2017a for 'lsqlin'. Please upgrade to that version to avoid this issue.