To the best of my knowledge, I’m not sure there’s a way of doing this elegantly inside CVX. (I’d be curious to know what problem you’re trying to solve.)
You can always add the constraint as follows
for k = 1:n,
X(:,:,k) == X(:,:,k)';
end
This will manually constrain the matrices to be symmetric.
Although the notation appears to be elegant, I believe that if you declare a matrix variable to be symmetric, CVX makes sure to only store / use the upper triangular or lower triangular part. So this notation actually increases (roughly double) the number of variables that CVX will use. If these matrices are small enough, you should be fine, but just something to keep in mind.
Here’s a silly example to prove my point:
cvx_begin
variable X(2,2) symmetric
minimize norm(X,'fro')
subject to
X >= 1
cvx_end
The call to SeDuMi reads
Calling sedumi: 7 variables, 3 equality constraints
If you instead wrote
cvx_begin
variable X(2,2)
minimize norm(X,'fro')
subject to
X >= 1
X == X'
cvx_end
the call to SeDuMi reads
Calling sedumi: 9 variables, 5 equality constraints
The 2 extra variables come up from having to treat the lower right (or upper right) variable explicitly.
Just use that for loop with caution.
Update: I just realized that you’re trying to solve an SDP. In that case, you can also write the for loop as
for k = 1:n,
X(:,:,k) == semidefinite(m)
end
assuming that you also want X_k to be PSD.