Solving optimization involving square of quadratic

Hi guys, here I met this problem:

max (w’Aw)^2/(w’Bw)
s.t. w*w’ = 1.
here, A and B are Hermitian matrices, w is a complex vector. To solve this, first I use semidefinite relaxition to transform the problem to:

max (trace(AW)^2)/(trace(BW))
s.t. W>=0, trace(W)=1
where W = w*w’, and we drop the constraint “rank(W) = 1” for relaxition.

then, introducing a auxilary parameter t, the problem becomes
max t
s.t. W>=0, trace(W) = 1, (t, trace(BW); trace(BW), trace(AW)) <= 0.

Then I tried to use the CVX SDP mode to solve this, but unfortunetely I can’t get the correct result. My question is:
Do I need to transform all matrices into real-value matrices, when using CVX SDP? or is there anything wrong in the process I listed above?

Thank you!

You might consider using quad_over_lin(trace(A*W), trace(B*W)) as your objective. Note that this enforces trace(B*W)>0 implicitly.