help！My optimization problem has hundreds of matrix variables and thousands of constraints, how do I express them effectively?

You can declare a 6D array, in which the last 4 dimensions are over the `l`

indices.

`variable G(4,4,4,4,4,4) hermitian`

which makes `G(:,:,l1,l2,l3,l4)`

a 4 by 4 hermitian matrix for each value of l1,l2,l3;l4.

Use a 4-fold nested fro loop for the semidefinte constraints. I don’t know of a way

to vectorize that. I think the double sum in the semidefinite constraints can be vectorized - see How to vectorize most constraint loops in CVX by @jackfsuia

The objective can be written as `-sum(sum(eta.*p))`

or as `-sum(eta(:).*p(:))`

.

It might take a while for CVX to process the problem. I have no idea how difficult or time consuming it will be for the solver. I suggest using Mosek as solver if it is available to you.

Perhaps you can try a smaller problem first (for instance, the `l`

from 1 to 2, rather than 1 to 4), to see how long that takes for CVX to generate.

Anyone else should feel free to provide other, hopefully better, suggestions.

Ok, I’ll give it a try as you suggested. Thank you for your advice！