LSQLIN Implementation with Sparse Matrices

1 view (last 30 days)
I am considering updating to R2014b and just have a quick question about the implementation of the LSQLIN function. Are sparse matrices supported for all algorithms and solution constraint types (inequality, equality, bound) with this function in 2014b? This was not the case in 2012b. I could not readily find the answer to this in the LSQLIN documentation or the "Choosing the Algorithm" document. Thanks for any information anyone can provide.

Accepted Answer

Matt J
Matt J on 25 Feb 2015
No, not for all algorithms. The following test in R2014b confirms this.
>> C=speye(3); d=sparse([3;2;1]); A=C; b=d; lsqlin(C,d,A,b)
Warning: The trust-region-reflective algorithm can handle bound constraints only;
using active-set algorithm instead.
> In lsqlin at 304
Warning: Cannot use sparse matrices with active-set algorithm: converting to full.
> In lsqlin at 353
Optimization terminated.
ans =
3
2
1
The strange thing, however, is that in R2013b, the active-set algorithm handles sparse input just fine, or at least it does not return a warning as above,
>> C=speye(3); d=sparse([3;2;1]); A=C; b=d; lsqlin(C,d,A,b,[],[],[],[],[],optimoptions(@lsqlin,'Algorithm','active-set'))
Optimization terminated.
ans =
3
2
1
  1 Comment
Nolan Pell
Nolan Pell on 26 Feb 2015
Thanks Matt I appreciate your information. This seems to be a similar constraint to 2012b - if the problem requires anything other than bound constraints, sparse inputs are not supported. It does seem strange that it does not produce a warning in 2013b, but I have my suspicions that it operates in a similar fashion. Hopefully this is an option that becomes available in future years. Cheers - NP

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!