MATLAB: LSQLIN Implementation with Sparse Matrices

lsqlinOptimization Toolboxr2014bsparse matrices

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.

Best Answer

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