SOS optimization/ reformulate symbolic expresions

Hey there,

I want to check if a given polynomial `p(x)` is a Sum-of-Squares polynomial; therefore, I need to find a positive semi-definite matrix `Q` such that `p(x) = z(x)' Q z(x)` where `z(x)` is a vector containing monomials in `x`.

So, I would like to create a symbolic vector `z(x) = [1 x x^2 ...]'` and invoke the optimization problem like the following:

``````syms x
z =  z(x) = [1;  x; x^2]

cvx_begin

n = size(z)
variables Q(n,n) SDP

subject to

p(x)  == z(x)' Q z(x)

cvx_end
``````

I do know that the equality does not work as syms and cvx objects are not compatible. However, I wonder if someone has a trick to circumvent this issue, or even better, if someone already implemented SOS optimization on cvx.

Thank you for your help and greetings,

Maurits

ps.: yeah yeah, there is SOSTOOLS but I need DSOS; and the lingo in spotlessSOS is rather hard.

I don’t know if you’ll find anything on SOS for CVX.

However, YALMIP has an SOS framework https://yalmip.github.io/tutorial/sumofsquaresprogramming/ .

I didn’t and thus settled for the spotless package. Though the overall package is rather undocumented, in the files forked by majumdar is an implementation example for DSOS.