On 9/2/2010 8:10 PM, iloveyu wang wrote:
> I was doing a simple linear least square fit using lsqlin with constraints:
> min||Ax-(b-c)|| with -Ax<=c, A is a m*n sparse matrix. m = 65536 and n =
> x , c are vectors with length 83 and 65536 respectively.
> Matlab msg:
> ??? Error using ==> vertcat
> Out of memory. Type HELP MEMORY for your options.
> Error in ==> lsqlin at 216
> if isempty([Aeq;A]) && isempty([beq;b]) && all(isinf([lb;ub]))
> Is this problem too large for Matlab to handle? It seems hard to imagine
> it will run out of memory.
The function reference pages for LSQLIN state:
"The large-scale algorithm requires only upper and lower bounds, meaning
no linear inequalities or equalities. Otherwise, lsqlin uses the
The pages that describe what medium-scale means say:
"Large-Scale vs. Medium-Scale Algorithms. An optimization algorithm is
large scale when it uses linear algebra that does not need to store, nor
operate on, full matrices. This may be done internally by storing sparse
matrices, and by using sparse linear algebra for computations whenever
possible....In contrast, medium-scale methods internally create full
matrices and use dense linear algebra."
So I am sorry, but for your problem (with inequalities), LSQLIN uses
dense linear algebra, not sparse.
You could try using one of the sparse solvers on your problem, ones that
might be less efficient, but could handle the problem using sparse
linear algebra. Perhaps fmincon interior-point would work for you. Or
perhaps you can reformulate your problem to work with the large-scale
MATLAB mathematical toolbox documentation