How to write this objective function in CVX, see figure below. Thank you very much.

# How to write this objective function that can be recognized in CVX

**xiaolilixiao**(li xiao) #1

**Mark_L_Stone**(Mark L. Stone) #2

I will presume `w >= 0`

. Of course, if no constraints are added, H = matrix of zeros will be optimal with optimal objective value = 0.

```
cvx_begin
variable H(n,n)
V = sqrt(diag(w))*H'*X;
minimize(vec(V)'*vec(V))
% place constraints here
cvx_end
```

**xiaolilixiao**(li xiao) #5

**Mark_L_Stone**(Mark L. Stone) #6

I believe that is convex for `C = ones(n).`

, i.e., for `sum(vec(H*H'))`

However, I believe it is not convex for general elementwise nonnegative `C`

. For instance, let `C=[1 2;1 1]`

. Then the Hessian with respect to the 4 elements of `H`

of `sum(vec(C.*(H*H')))`

has two eigenvalues equal to 5 and two eigenvalues equal to -1, and hence is indefinite, so `sum(vec(C.*(H*H')))`

is not convex.