LSQLIN Implementation with Sparse Matrices
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
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
More Answers (0)
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!