I’m running the below optimization to project a variable Zs to Zs_proj. Zs contains N submatrices, each of size NxN. The code below asks that in the projected version each of these submatrices be positive semidefinite with trace 1, and that the sum over these submatrices be the identity matrix. Clearly, if we just set the i-th submatrix to be a zeros matrix with a single 1 in entry (i, i), all the constraints are satisfied. However, for some Zs inputs, cvx fails with the result ‘Infeasible’. I’ve tried a variety of values for the cvx_precision setting, but ‘Infeasible’ persists.

Any suggestions as to how to make this code work consistently?

```
cvx_begin
variable Zs_proj(N, N, N);
minimize(sum((Zs(:) - Zs_proj(:)).^2));
subject to
sum(Zs_proj, 3) == eye(N);
for r = 1:N
Zs_proj(:, :, r) == semidefinite(N);
trace(Zs_proj(:, :, r)) == 1;
end
cvx_end
```