How to express trace(P* A * H * Hh * Ah ) in CVX

I want to express trace(Ah * H * K * Hh * A) where:

A = 3X1 complex variable
H = 3X3 complex matrix, diagonal
Hh, Ah = hermitian of H and A respectively
K = 3X3 real valued matrix

I used this code:

cvx_begin
   variables A(3)
   power1 = tr(A' * H * K * H' * A);
cvx_end

But it gives me an error:

Disciplined convex programming error:
   Invalid quadratic form: must be a scalar.

I checked another question here:
Invalid quadratic form: must be a scalar (trace minimization)

which suggested using cholsky decomposition to express similar problem:

 trace(LM'*A*LM)  =  trace(LM'*R'*R*LM)    %if A is a positive definite, 

which Then can be expressed in CVX by:

 sum_square(R*LM)

I used the same technique by assuming:

 cvx_begin
    variables A(3)
    [R,p] = chol(K) 
    % power1 = tr(A' * H * R' * R * H' * A) = tr (A' *H*K*H' * A )
    power1   = sum_square(A'*H*R')
 cvx_end

But i got the following error as sum_square work only on real arguments:

Error using cvx/sum_square (line 7)
Disciplined convex programming error:
The argument to SUM_SQUARE must be real and affine.

Error in testing_cholsky_for_trace (line 19)
    power1   = sum_square(A'*H*R')

I want to know if their are other alternative to express this formula for complex entries to get the trace of the given problem?

Use sum_square_abs for complex values. But whenever possible, as described here in the CVX documentation, avoid quadratic forms altogether.

2 Likes