# CVX error in using pow_cvx

Hi,
I’m trying to run CVX to solve this problem:

cvx_begin
variable Pa(20,10)
for kk=1:10
for ii=1:20
obj(ii,kk)=Matrix(ii,kk)*inv_pos((Matrix(ii,kk)*(Pa(ii,kk))^2+1));
end
end
minimize sum(sum(obj))
subject to
sum(sum(Pa))<=P_total;
cvx_end


but I have the following error:
Error using cvx/pow_cvx (line 144)
Disciplined convex programming error:
Illegal operation: pow_p( {convex}, {-1} )

Error in cvx/inv_pos (line 5)
y = pow_cvx( x, -1, ‘pow_p’ );

where Matrix is constant contains singualr values of different matrices.

(Mark L. Stone) #2

You have violated CVX’s rules for inv_pos . Why isn’t CVX accepting my model? READ THIS FIRST!

I am presuming Matrix(ii,kk) >= 0 due to being a singular value of something. Therefore, the argument of inv_pos is convex, which is not allowed (unless affine, which this is not).

help inv_pos

inv_pos Reciprocal of a positive quantity.
inv_pos(X) returns 1./X if X is positive, and +Inf otherwise.
X must be real.

 For matrices and N-D arrays, the function is applied to each element.

Disciplined convex programming information:
inv_pos is convex and nonincreasing; therefore, when used in CVX
specifications, its argument must be concave (or affine).


Indeed, obj(ii,kk) is non-convex. Looking at the 2nd derivative of the RHS, even for Pa(ii,kk) > 0, the sign of the 2nd derivative changes from negative to positive at Pa(ii,kk) = 1/sqrt(Matrix(ii,kk)*a), assuming that Matrix(ii,kk) > 0 ;

Thank you very much for your response. I was trying to solve the following problem

\text{min}_{\delta_{k,i}}. \sum_{k=1}^{K} \sum_{i=1}^{r} \frac{\lambda_{k,i}}{1+\lambda_{k,i}\delta_{k,i}^{2}} \\ \text {s.t}. \sum_{k=1}^{K} \sum_{i=1}^{r} \delta_{k,i}^{2} \leq P
In the my code given above K=10, r=20, \lambda_{k,i} \geq0 are the enteries of the Matrix given in the code above.

I was trying to solve this problem because it was claimed to be a convex problem according to the following paper.

Low-Rank Covariance-Assisted Downlink Training and Channel Estimation for FDD Massive MIMO Systems
IEEE TRANSACTIONS ON WIRELESS COMMUNICATIONS, VOL. 16, NO. 3, MARCH 2017

(Mark L. Stone) #4

The math model you have just shown is convex, and is NOT what you had in your code. Specifically, your code has Pa(ii,kk)^2 in obj(ii,kk), but the constraint is summing Pa. The math model has delta^2 (a.k.a. Pa^2) in both places.

So the way to model this in CVX is to define a CVX variable, call it Pa_sq or whatever you want, instead of Pa. Then obj and the constraint will both be in terms of Pa_sq, with no squares. That will make the argument of inv_pos affine, and it will be accepted by CVX. You need to add a constraint Pa_sq >= 0 . Because obj is an array, you will need to declare it as an expression you would have encountered an error due to that if you had gotten the first element of obj accepted. Although not necessary, Instead of using obj and the for loops, you could vectorize the objective as follows: minimize(sum(sum(Matrix.*inv_pos(Matrix.*Pa_sq+1))))

Then if you need the optimal value of delta (or Pa), use sqrt(Pa_Sq), after cvx_end, at which time Pa_sq` will have been populated with its numerical optimal value by CVX.