Packages for Semidefinite programming

Semidefinite programming (see here) has been added to Mathematica 12. Example

(*Dimension of matrices*)
d = 5;
(*Create matrices a0,a1,a2*)
a0 = RandomReal[{-1, 1}, {d, d}];
a0 = a0.Transpose@a0;
a1 = IdentityMatrix@d;
v = RandomReal[{-1, 1}, d];
a2 = TensorProduct[v, v];
a = {a0, a1, a2};
(*Vector c on objective function f = c.x*)
c = {3, 1};
(*Compute solution*)
sol = SemidefiniteOptimization[c, a];
(*Check solution*)
A = a0 + sol.{a1, a2};
ev = Sort@Eigenvalues@A;
q = PositiveSemidefiniteMatrixQ@A;
Print["Minimizer {x1,x2} of c.x such that A = a0+x1*a1+x2*a2 is \
positive semidefinite: \n\t", sol, "\nEigenvalues of A: \n\t", ev, "\n\
Is A positive semidefinite?\n\t", q]

enter image description here


This add-on is the best I've found: https://github.com/NCAlgebra/NC

The documentation that is more specific to SDPs is here: http://www.math.ucsd.edu/~ncalg/DOCUMENTATION/index.html#SemidefiniteProgramming