Exercise 4.47: Maximum determinant PSD matrix completion

% Boyd & Vandenberghe "Convex Optimization"
% Almir Mutapcic - Jan 2006
%
% Given a symmetric matrix A in R^(n-by-n) with some entries unspecified
% we find its completion such that A is positive semidefinite and
% it has a maximum determinant out of all possible completions.
% This problem can be formulated as a log det (and det_rootn) problem.
%
% This is a numerical instance of the specified book exercise.

% problem size
n = 4;

% create and solve the problem
cvx_begin sdp
  % A is a PSD symmetric matrix (n-by-n)
  variable A(n,n) symmetric;
  A >= 0;

  % constrained matrix entries.
  A(1,1) == 3;
  A(2,2) == 2;
  A(3,3) == 1;
  A(4,4) == 5;
  % Note that because A is symmetric, these off-diagonal
  % constraints affect the corresponding element on the
  % opposite side of the diagonal.
  A(1,2) == .5;
  A(1,4) == .25;
  A(2,3) == .75;

  % find the solution to the problem
  maximize( log_det( A ) )
  % maximize( det_rootn( A ) )
cvx_end

% display solution
disp(['Matrix A with maximum determinant (' num2str(det(A)) ') is:'])
A
disp(['Its eigenvalues are:'])
eigs = eig(A)
 
Successive approximation method to be employed.
   SDPT3 will be called several times to refine the solution.
   Original size: 58 variables, 17 equality constraints
   For improved efficiency, SDPT3 is solving the dual problem.
   Approximation size: 67 variables, 22 equality constraints
-----------------------------------------------------------------
 Target     Conic    Solver
Precision   Error    Status
---------------------------
1.221e-04  4.919e-03  Solved
1.221e-04  0.000e+00  Solved
1.490e-08  0.000e+00  Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +3.02422
Matrix A with maximum determinant (20.578) is:

A =

    3.0000    0.5000    0.1875    0.2500
    0.5000    2.0000    0.7500    0.0417
    0.1875    0.7500    1.0000    0.0156
    0.2500    0.0417    0.0156    5.0000

Its eigenvalues are:

eigs =

    0.5964
    2.0908
    3.2773
    5.0355