Linear operator on a matrix in SDP


I want to know if there is a way to do this in cvx, or if this is a dead end. The problem is this (toy version in code below). Basically, I want to optimize over a known spectrahedral representation of a convex body. In theory, this is doable. But, for using cvx I need to represent the additive compound matrix (which I can compute explicitly given the original matrix) inside the constraints. The additive compound matrix function is a linear operator on a matrix; I don’t know any convenient way of representing linear action on a matrix. Using my own function which calculates the elements individually in for loops gives me the following error. The function has intermediate variables, is that causing the problem? If needed, I can post the code for the additive compound matrix computation. Thanks a lot!

The following error occurred converting from cvx to double:
Error using double
Conversion to double from cvx is not possible.

    Error in additive_compound (line 24)
                    L_k(i,i) = sum(diagonal(a{i}));
    Error in orbitope_simple (line 9)
        sum(eigenvals(1:i))*eye(nchoosek(3,i)) - additive_compound(A,i) >= 0;

The toy problem code is pasted below.

B = [1,2,3;2,4,5;3,5,6];
eigenvals = sort(eig(B),'descend');

cvx_begin sdp
variable A(3,3) symmetric;
subject to
for i=1:3
    sum(eigenvals(1:i))*eye(nchoosek(3,i)) - additive_compound(A,i) >= 0;

You can try declaring converting L_k to a CVX object with this: L_k = cvx(L_k); before you start assigning to it. It’s going to take a long time, though; for loops are slow…

Perfect! Thank you. Slow is fine for now, as long as it works. :slight_smile: