Out of memory on sparse matrix/vector operations

55 views
Skip to first unread message

Noam

unread,
Sep 8, 2021, 6:40:31 PM9/8/21
to YALMIP

I have a sparse (double) matrix A, and a sdpvar vector x. Running
y = A*x;
runs fine.
But when I do any operation on y such as y.*2, y'*y, or even norm(y,2)^2, I get an error.

Example:

>> y
Linear matrix variable 611204x1 (full, real, 153600 variables)
Coeffiecient range: 3.8147e-06 to 47.167
>> y'*y
Error using  *  (line 524)
Error using ones
Requested 153600x153600 (175.8GB) array exceeds maximum array size preference. Creation of arrays
greater than this limit may take a long time and cause MATLAB to become unresponsive.

What am I missing?

Thanks,
Noam

Johan Löfberg

unread,
Sep 9, 2021, 1:10:59 AM9/9/21
to YALMIP
There are so many monomial terms in that squared expression that it simply cannot be generated.

Hence create a model where the explicit squared expression isn't needed, but work with the norm only. Whether the solver will be able to do anything is another issue, but that is not a YALMIP issue.

Reply all
Reply to author
Forward
0 new messages