Here is the first example provided in the section Semidefinite Programming of the documentation of cvxopt text
Below is the code provided there:
from cvxopt import matrix, solvers
c = matrix([1.,-1.,1.])
G = [ matrix([[-7., -11., -11., 3.],
[ 7., -18., -18., 8.],
[-2., -8., -8., 1.]]) ]
G += [ matrix([[-21., -11., 0., -11., 10., 8., 0., 8., 5.],
[ 0., 10., 16., 10., -10., -10., 16., -10., 3.],
[ -5., 2., -17., 2., -6., 8., -17., 8., 6.]]) ]
h = [ matrix([[33., -9.], [-9., 26.]]) ]
h += [ matrix([[14., 9., 40.], [9., 91., 10.], [40., 10., 15.]]) ]
sol = solvers.sdp(c, Gs=G, hs=h)
Note that when defining G, the square matrices have been converted to column vectors. On the other hand, the square matrices keep their shapes when defining h. This code runs correctly and finds a solution.
I tried "matching the types" by converting the matrices in h to column vectors. However, it returned an error:
TypeError: hs[0] has size (4,1). Expected size is (2,2).
I couldn't figure out why there needs to be a mismatch of the shapes of the matrices on the two sides of the condition Gx <= h.
