Can we learn a matrix instead of a vector?

Can we optimize a matrix instead of a vector?

You can optimize (with respect to) a matrix variable, but the objective function has to evaluate to a scalar. Of course, that’s true for a vector as well.

For instance, let’s say you want to find the positive semi-definite matrix X which is closest in Frobenius norm to the 9 by 9 matrix C.

variable X(9,9)
minimize(norm(X - C,'fro'))
X == semidefinite(9)