Using rel_entr in cvx for : x*log2(1+a*Trace(b*y)/x)

Sir,

I am debugging my code, kindly help

A=rand(2,2)+1i * rand(2,2);
B=5;
cvx_begin
variable x nonnegative;
variable y(2,2) complex semidefinite;
obj= -rel_entr(x, x+B * trace(A * y))/log(2);
maximize obj;
subject to
x <= 1;
trace(A * y) <= 5;
cvx_end
Optim_val=obj;

This code is giving me an error :
Error using cvx/rel_entr (line 71)
Disciplined convex programming error:
Illegal operation: rel_entr( {real affine}, {complex affine} ).

Error in CVX_debug_trace_mul (line 9)
obj=-rel_entr(x,x+Btrace(Ay))/log(2); %xlog2(1+aTrace(b*y)/x), a and b are constants


In this case :
cvx_begin
variable x(2) nonnegative;
variable t(2) nonnegative
variable y(2,2) semidefinite;
obj=-rel_entr(t(2,1),t(2,1)+B * trace(A * y))/log(2);
maximize obj;
subject to
t(1,1)+t(2,1) <= 1;
x(1,1)+x(2,1)<=trace(A * y);
cvx_end

The code is not giving any error but status is Failed.
In my code, A is a complex double matrix. What can be done in this regard? Kindly do needful.
Thank you.

1 Like

The arguments of rel_entr must be real.

Stepping back to look at this as an optimization problem, without regard for CVX or its rules, your objective function is complex. What does it mean to maximize a complex variable? is 2+i greater than 3-i?

Your objective function must evaluate to real scalar. It is your problem (or wherever you got it from), not mine, so i don’t know what the fix should be. Maybe you want real(trace(....)), and also in the constraint?

1 Like