# Dealing with matrix multiplication

Hello,

The below code snippet is the one that I am using for optimization, here R is an NxN PSD matrix and T,N,sigma2 and P_t are scalar constants, I am having issue with matrix multiplication in the objective function as it is leading to “Only scalar quadratic forms can be specified in CVX”. Any suggestions to address this will help. My objective function is convex.

``````> cvx_begin
>     variable X(T,N)
>     minimize( trace(R-R*X'*inv(X*R*X'+sigma2*eye(T))*X*R) );
>     subject to
>         trace(X*X') <= P_t;
> cvx_end
``````

Thanks

If your program had gotten past the `minimize` statement it would have encountered the same error on the constraint.

Fortunately, the constraint can be reformulated as
`norm(X,'fro') <= sqrt(P_t)`

Please show us your proof that the objective function is convex, which is not obvious to me. In doing so, follow the guidance in

Thanks for the reply. My objective function is the mean square error expression for MMSE estimator. It is convex in nature and the program didn’t go past `minimize` statement and I see “Only scalar quadratic forms can be specified in CVX” error. I also tried simplifying the objective function using matrix inversion lemma, which leads to `minimize( trace(R*inv( eye(N)+(1/sigma2)*X'*X*R )) );`, yet I see the same error.

It is convex in nature is not a proof. As a Math and Operations Research major, I learned many joke proof techniques. But “in nature” is a new one for me. So at least I have learned something new today.

Linear least squares is always convex. Not so for nonlinear least squares, even though it is least squares in nature.

I am sorry. I shouldn’t have told so. I will post the proof of my objective function being convex. Can you suggest someway by which I can get rid of "Only scalar quadratic forms can be specified in CVX” error?

In some cases yes, such as the constraint.

If the objective is convex, perhaps it can be reformulated to comply with CVX’s DCP rules. If it is not convex, then no. And even if you found a DCP-compliant representation for the objective, it needs to be convex, because it is minimized. Yet, there is a minus sign in front of what perhaps, if you’re lucky, would be a (convex) norm, and hence would be concave, not convex. Due to linearity of `trace`; the `R` term preceding the minus inside the trace can be removed without affecting the argmin. So that negative term is where all the actual “action” is.

So you prove your convexity proof first. If it is determined to be a valid proof, then perhaps someone will be able to come up with a DCP-compliant formulation. I remain extremely skeptical of convexity, to put it mildly.

Thanks. I will work on it