Bug/fix with 1x1 (scalar) sdpvar and 3-dimension repmat

50 views
Skip to first unread message

Olivier Mégel

unread,
Jun 18, 2015, 9:33:18 AM6/18/15
to yal...@googlegroups.com
Hi Johan,

I think I have spotted a bug when trying to duplicate a scalar sdpvar into a 3-dimension sdpvar object:

reproducible code :
P_prev=sdpvar(1,1)
P_prevS
=repmat(P_prev,[2,2,2])

I tried with other replication factors than [2,2,2], they all seem to lead to the same error (even [1,1,1]), it seems to come from the MATLAB reshape function:

"Error using reshape
ND sparse arrays are not supported." 
This error can be spotted by putting a breakpoint in yalmip\@sdpvar\repmat.m , line 50 (= reshape(B,siz);).

However, when replacing this line by 
        try
            B
= reshape(B,siz);
       
catch
            B
= reshape(full(B),siz);
       
end
It seems to work. Does this solve the issue, or am I messing up something else in YALMIP by doing this?

Best,
Olivier





Johan Löfberg

unread,
Jun 18, 2015, 10:12:12 AM6/18/15
to yal...@googlegroups.com
works, but doesn't scale well 

(but neither does the current code, needs a complete overhaul)

Olivier Mégel

unread,
Jun 19, 2015, 6:02:59 AM6/19/15
to yal...@googlegroups.com
OK thanks for the info!
Reply all
Reply to author
Forward
0 new messages