SDP in CVX: problem understanding optimal-design code


I’ve been trying to understand and generalize a piece of code which is one of the examples in the tutorial of CVX for Python, but I don’t completely understand the code, and Google hasn’t been very useful.

The particular problem is how to solve a semidefinite program for A-optimality (Boyd’s book, Section 7.5), and the program is as follows (given here


minimize tr (V*diag(x)*V’)^{-1}
subject to x >= 0
sum(x) = 1

equivalent to:
minimize tr Y
subject to [ V*diag(x)*V’, I ]
[ I, Y ] >= 0
x >= 0
sum(x) = 1

The code in the example can be found in the previous URL.

In that case the dimension of the points is 2, and the number of points is 20.
I just want to generalize to any number of points n, and any dimension d.
I don’t understand why the dimension of the matrix Gs is 16 there, and how/why the -1’s are introduced in those positions.
My best attempt for my generalization was:

I don’t know why the number of variables needs to include an “extra” dimension.
The error I get when I try to solve the problem with the previous code is the squareroot of the number of rows in ‘Gs[1]’ is not an integer, but I don’t understand why Gs should have a squared number of rows as from

minimize tr Y
subject to [ V*diag(x)*V’, I ]
[ I, Y ] >= 0

it is not obvious.


There actually is no such thing as “CVX for Python”. There is cvxpy, which is of course inspired by CVX, but it is developed by others. You’ll need to find a forum devoted to cvxpy to get assistance, I’m afraid.