# Basic complex SDP problem: the maximal value is not reached?

Hello every one,

I am trying to solve a basic SDP problem with complex matrices and get some problem regarding the solution. Here is the problem:

Given two (2x2) hermitian matrices Z1, Z2:
maximise(trace(Z1 E1) + trace(Z2 E2))
with E1 + E2= II (identity), trace(E1)<=1, trace(E2)<= 1, and E1 E2 hermitian semidefinite.

Here is the code:

clc; clear all; close all;

II= eye(2);

Z1 = [0.0206 + 0.0000i 0.0000 + 0.0347i;
0.0000 - 0.0347i -0.0205 + 0.0000i];
Z2 = [-0.0206 + 0.0000i 0.0000 - 0.0347i;
0.0000 + 0.0347i 0.0205 + 0.0000i];

%Solving directly:
[V,D]= eig(Z1);
RHS= abs(D(1,1)-D(2,2));

if (D(1,1)>D(2,2))
P1= V(:,1)*V(:,1)’;
else
P1= V(:,2)*V(:,2)’;
P2= II-P1;
end;

%Solving via CVX:
cvx_begin sdp quiet
variables E1(2,2) E2(2,2);

``````E1==hermitian_semidefinite(2);
E2==hermitian_semidefinite(2);
``````
``````maximise(real(trace(Z1*E1)+trace(Z2*(E2))));
``````
``````subject to
E1+E2==II;
trace(E1)<=1.;
trace(E2)<=1.;
``````

cvx_end

RHS= real(trace(Z1E1)+trace(Z2E2))
RHS= real(trace(Z1P1)+trace(Z2P2))

The output is:

RHS =

``````0.0411
``````

RHS =

``````0.0807
``````

So the minimal solution is not reached by CVX. I found out that E1, E2 are both “real” in the solution. Could that be the reason? Or do I misunderstand CVX somehow?