Imposing a block diagonal matrix form

Hi all,

Is there an easy way of imposing a block diagonal form on a matrix that is being optimized using CVX (i.e. a diagonal matrix whose diagonal is composed of other smaller square matrices)?

Thanks for the help!

P.S. I’m a new user so please let me know if my question is unclear.

I would probably allocate each block separately and then concatenate them together with blkdiag:

variables x1(3,3) x2(3,3) x3(3,3)
expression x4
x4 = blkdiag(x1,x2,x3);