A problem with quad_over_lin function

I just use the ‘quad_over_lin’ function and find that the it gives a complex-valued output. For example, x =

[ 0.5377 + 0.3188i
1.8339 - 1.3077i
-2.2588 - 0.4336i
0.8622 + 0.3426i]

the value of quad_over_lin(x,3) is 2.4603 - 0.6346i. I suspect that quad_over_lin(X,Y) currently produces SUM((X).^2)./Y, not the correct one which should be SUM(ABS(X).^2)./Y.

Is it a bug or am I missing something?

You’re probably right. But keep in mind that the version of quad_over_lin used in CVX models is different than the one used outside of CVX models. So you an go head and try using quad_over_lin with complex input in CVX models and see if it works for you. If for some reason it’s still a problem, use quad_pos_over_lin(abs(x),y) instead.

EDIT: If you want to fix this manually, edit the file cvx/functions/quad_over_lin.m and replace

z = sum_square( x, dim );

on line 43 with

z = sum_square_abs( x, dim );

(This assumes the latest version of CVX.)

Thanks for the answer. I will edit cvx/functions/quad_over_lin.m as you suggested.