% sdpsol source minVe_ell -- find the minimum volume ellipsoid
%   { x | x'*A*x + 2*b'*x + (b'*inv(A)*b-1) < 0 }
% containing the given ellipsoids in R^2
%   { x | x^T*A_i*x + 2*b_i^T*x + c_i < 0 }, i = 1,...,L
% where
%   As = [A1 A2 ... AL]:  L 2-by-2 positive definite matrices
%   bs = [b1 b2 ... bL]:  L 2-vectors
%   cs = [c1 c2 ... cL]:  L scalars
%
% maxdet problem:
%   minimize    -log det A
%   subject to  [A   b  0 ]         [A_i  b_i  0]
%               [b' -1  b'] - tau_i*[b_i' c_i  0] <=0, i=1,...,L
%               [0   b -A ]         [0    0    0]
%               tau_i >= 0, i=1,...,L
%               A > 0
%
% WARNING: cannot be run using the stand-alone sdpsol from UNIX, since As,
%          bs, cs, L are not defined

variable A(2,2) symmetric;
variable b(2,1),tau(L,1);

for i=1:L;
  [A, b, zeros(2,2);
   b', -1, b';
   zeros(2,2), b, -A]
  - tau(i,1)*[As(:,[2*i-1,2*i]), bs(:,i), zeros(2,2);
              bs(:,i)', cs(1,i), zeros(1,2);
              zeros(2,5)] < 0;
end;
tau .> 0;
A > 0;

minimize obj = -logdet(A);

ABSTOL = 1e-4;
RELTOL = 1e-3;
GAMMA = 500;