I read a piece of code in a SDP model,like this:
variable V(24,1)
expression W(14,14)
for in=1:14
W(in,in)=W(in,in)+sparse(tx,fx,V,14,14)
end
I tried let W as zeros and V as ones, it dosen’t work.But it works in a model this way.
Why?
What’s this mean?
Hope for your help.
Cheng Kung
What's an expression plus a sparse matrix mean?
EDIT: Sorry, I misread. the sparse function is placing the elements of V in the locations enumerated by the rows tx and the columns fx.
Yes, the sparse function is an matrix.So,what I can’t understand is why it can plus by an element of an expression without error. It’s invalid in MATLAB that an element(or scalar) plus a sparse matrix.