% sdpsol source mat_completion -- positive definite matrix completion
% with partially specified inverse.
%
% maxdet problem
%   minimize    Tr(C*(D+Delta))-logdet(D+Delta)
%   subject to  D+Delta > 0
%               diag(D) = 0

D=diag([2.34, 0.57, 1.13, 3.95]);
C=[ 3.46, -1.01,  0.38, -1.47; 
   -1.01,  4.44, -1.48,  2.88;
    0.38, -1.48,  2.43,  0.94;
   -1.47,  2.88,  0.94,  3.97];
variable Delta(4,4) symmetric;  % declare 4x4 symmetric variable Delta

% equality constraints
diag(Delta) == zeros(4,1);
% LMI constraint
D+Delta > 0;

% specify the objective
minimize obj_value = Tr(C*(D+Delta))-logdet(D+Delta);
