Why are my sparse matrices converted to full matrices by 'lsqlin'?

1 view (last 30 days)
I have some large sparse matrices (300000x100000) 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 261097x81168 (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

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Dec 2017
Better support for sparse matrices was added in R2017a for 'lsqlin'. Please upgrade to that version to avoid this issue.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!