# How to express minimize $trace(\sqrt{X'X}A)$ by CVX?

I want to minimize f(x) = trace(\sqrt{X'*X}A), where X is an matrix variable and A is a known matrix. I tried the following code:

cvx_begin
variable x(d,d)
minimize(trace(sqrt(sum_square_abs(x))*A))
subject to
x(sp_index) == M(sp_index)
cvx_end


However, there are still errors as following:

Error using cvx/sqrt (line 61)
Disciplined convex programming error:
Illegal operation: sqrt( {convex} ).

Error in Test_CVX_Iterative_Optimal (line 34)
minimize(trace(sqrt(sum_square_abs(x))*A))


So how should I solve this problem by CVX? Looking forward to your help! Thanks very much!

Update:
Thanks to @DavidKetcheson , I should use sqrtm() rather than sqrt. To represent trace(\sqrt{X^TX}) I should use trace_sqrtm(sum_square_abs(X)). However, I need to represent trace(\sqrt{X^TX}A), and I don’t know how to represent it by a valid CVX expression.

I tried

minimize(trace(sqrtm(sum_square_abs(x))*A))


to replace sqrt in the original, but I got the following error

Undefined function 'schur' for input arguments of type 'cvx'.

Error in sqrtm (line 32)
[Q, T] = schur(A,'complex');  % T is complex Schur form.

Error in Test_WeightNucNorm (line 35)
minimize(trace(sqrtm(sum_square_abs(x))*A))


I understand now that sqrtm() function is not implemented in CVX, so I have the error ’ Undefined function ‘schur’ for input arguments of type ‘cvx’.’. But my problem is still not solved.

I think I should use:

minimize(trace_sqrtm(sum_square_abs(x))*A)


But I still get error:

Error using cvx/trace_sqrtm (line 9)
Input must be affine.

Error in Test_WeightNucNorm (line 40)
minimize(trace_sqrtm(sum_square_abs(x))*A)


Important update
Thanks to @k20 , I made a mistake!! This is not the weighted nuclear norm of matrix X, but the weighted trace of \sqrt{X^TX}!! Now my problem becomes that: how to represent the weighted nuclear norm of a matrix X, where X is CVX variable, A is a diagonal weight matrix. I tried to find a CVX function which give me all the singular values of variable X, but I haven’t found such a function.

I can almost make conclusion that CVX cannot solve this problem. I need to find some other algorithms.

Leaving aside the sqrt for the moment, your objective function is not a scalar. You’re not going to be “successful” until you define a scalar objective function. Then, to use CVX, the objective must be convex and expressible within its rule set. But first things first, no matter what tool you use.

Read the FAQ first. Then, click the “EDIT” button and edit your model so it reflects Mark’s point about scalar objectives… and then we’ll see if we can solve your problem.

Hi @Mark L. Stone , thanks very much for your help! I want to simplify my question to show the key problem. Now I edited my question. The key problem is still the sqrt() function, and I don’t know how to solve it. Can you help? Thanks very much!

Hi @mcg , thanks for your reply! I updated my question. My original question was simplified to show the key problem, but then it is a mistake, as @Mark said. Can you check the new question and see whether it can be solved by CVX? Thanks!

Hi @mcg , for the FAQ and the rules, I have read them. But I still cannot solve my problem.

There’s still something amiss. That A is new, and the new model is not syntactically correct. But that might be a formatting error from the web site. What exactly are you intending to do with A?

As written, that model wouldn’t even be accepted by MATLAB much less CVX.

I’m sorry, even with the update I’m not seeing this. Now, when A was not present, I thought perhaps norm(x,'fro') would work for you. But this new incarnation just isn’t going to work.

I don’t think we’re going to get anywhere. Indeed I am not convinced that your model is even convex. Even if it is I am not convinced CVX can handle it.

I think CVX is not able to solve this problem now. I need to find other possible algorithms to solve it. Thanks everyone’s help!