How to compute inverse of matrix

If C is symmetric positive semidefinite (psd), let R = chol(C). Then trace(C*inv(phi) = trace(R'*R*inv(phi)) = trace(R*inv(phi)*R') . Then use the solution in Generalizing “trace_inv” for matrix quadratic forms

If C is not psd, then trace(C*inv(phi)) is not necessarily convex. For example, in one dimension, let C = -1, then trace(C*inv(phi)) = -1/phi, which is not convex.

If C is invertible and you are willing for phi*inv(C) to be implicitly constrained to be psd, you can simply use minimize(trace_inv(phi*inv(C)))