# How to formulate a problem of a sum with matrices pre- and post- multiplying

My problem involves the sum of matrices that pre- and post multiply the variable matrix.
The variable matrix, X, is of dimension pxm. The objective function is (in LaTeX format)

minimize:
| A + \sum_{k=0}^{N} B_k X C_k |

subject to:
\sum_{k=0}^M D_k X E_k \le F

and where A, B_k, C_k, D_k, E_k, and F are given matrices of appropriate dimensions.

I’m not sure how to represent either the objective function or the constraints.

1 Like

A rule of thumb that often works: pretend that your variable is actually just a standard numeric MATLAB vector/array/matrix. How would you compute the same quantity then? Chances are that’s exactly what you do in CVX, assuming the expression is DCP compliant.

So in this case, I would do something like this. Assume that B_k, C_k, D_k, and E_k are stored in 3-D arrays. Then you could do this:

variable X(m,n)
val = A;
for k = 1 : N
val = val + B(:,:,k) * X * C(:,:,k);
end
minimize(norm(val))
val = F;
for k = 1 : M
val = val - D(:,:,k) * X * E(:,:,k);
end
val >= 0;

BRILLIANT! I never think of using 3D matrices!

1 Like