# Is there a way around this error: Cannot perform the operation: {positive constant} ./ {convex}?

Hi,

I am trying to implement an optimization problem of minimizing the inverse of trace of the inverse psd matrix. However, the `/` invokes X/Y as X.*(1./(Y)) with the condition being that Y is a constant. In my case X/Y = 1/(trace_inv(X)) or , Y = trace_inv(CVX variable). Here’s the code for you to check it out.

N = 8;
P = 0.1;

cvx_begin

``````variable X(Ns,Ns) symmetric
minimize(1/(trace_inv(X)))   %% or (inv_pos(trace_inv(X)))
subject to
norm((trace(X)-P),2) <= 1e-5;
``````

cvx_end

I’ve tried to implement it using a dummy variable (code below) which doesn’t work either.

N = 8;
P = 0.1;

cvx_begin

``````variable X1(Ns,Ns) symmetric
variable Y

minimize(-Y)
subject to
(trace_inv(X1).* Y) == 1;
norm((trace(X1)-P),2) <= 1e-5;
``````

cvx_end

Please let me know if there is a way around this.

If X is diagonal and positive definite (positive diagonal), then as described at Error using logdet: A should be a square matrix of double or single class , 1/trace_inv(X) is the harmonic mean divided by Ns, which is concave (and can be handled in CVX per the Mosek Modeling Cookbook link there). Note that I corrected my linked answer which originally misstated the harmonic mean as being convex, rather than concave.

Therefore, this is a non-convex optimization problem as stated.

But do you really want `minimize(-1/trace_inv(X)`, as implied by your 2nd formulation? if so, the Mosek Modeling Cookbook link for Harmonic Mean shows how to handle that if `X is diagonal positive definite. It `X` is not diagonal positive definite, I don’t know whether the problem is convex. Do you? If not, it is incumbent on you to show us a convexity proof (unless someone else comes along and does so).

1 Like