I have an SDP problem with n variables where n can be of order of tens of thousands.

There are also O(n) SDP constraints. These can be described using linear matrix inequalities M_i > 0.

These M_i matrices are rather small (3x3).

One way to tackle this is to add these many small LMI constraints one after the other using a loop.

This seems to be rather slow though.

I was thinking of constructing a large matrix with all the constraints such that the matrix has some sort of block diagonal structure. In this case, the CVX program will eventually have a single large LMI constraint rather than many small LMI constraints. However, for this to fit into memory, one needs to use a sparse matrix.

My question is whether CVX can handle sparse matrices and if so, is there a way to do the construction of this matrix efficiently, possibly by avoiding the loop?

If this is not possible then my next question would be: is this a limitation of the way CVX is designed or is this related to the underlying solvers that are available out there? For example, will I benefit from trying to utilize a solver like Mosek (or any other) directly?