yalmip / YALMIP

MATLAB toolbox for optimization modeling
https://yalmip.github.io/
Other
488 stars 138 forks source link

SVD for sdpvar not defined #613

Closed zshn25 closed 5 years ago

zshn25 commented 5 years ago

Hi,

SVD for an sdpvarvariable gives error

>> svd(sdpvar(1,1)) Error using svd First input must be single or double.

If it is not supported, are there alternatives for calculating SVD of a variable?

johanlofberg commented 5 years ago

The first question is if you actually want the SVD, or if you simply intend to compute an expression which depends on the singular values, but has a representation which doesn't explicitly require a decomposition (such as nuclear norm etc)

In general though, an SVD decmposition is not easily represented, and the only way to do it is to brute force it by introdung matrices U,V,S and add the constraints X == USV', U*U'=eye(n) etc etc. Of course, an absolutely hopeless model which will fail in almost all setups

zshn25 commented 5 years ago

Thanks for your quick reply. I am using[U, ~, V] to compute a rotation matrix. Are you aware of any other way to do that?

When I assign the variable some initial value and use svd(value(variable)), I don't get any errors. But, is it even useful? I'm not sure how the optimizer works through this behind the scenes.

And do you plan to include svd implementation for sdpvar in future release?

johanlofberg commented 5 years ago

Of course you don't, as svd(value(x)) simply applies svd on the value you assigned, as the output from value is that data

The U and V matrices are nonconvex horrible operators from X, and there is no nice way to work with them explicitly in a convex way. If you want to develop some optimization model based explicitly on these, you are typically better of deriving a specialized solver, than trying to force them into a general nonlinear solver