I have the following trace term:
trace(Sk' Ck Sk)
where Sk is a KxM matrix and Ck is a KxK positive semidefinite matrix. I'm involving this trace term in a Matlab code and it seems to suffer when computing this term. How could I simplify it (if possible)?
In general, note that $\operatorname{trace}(AB) = \operatorname{trace}(BA)$, whenever both matrix multiplications are defined.
So, we can rewrite your expression as $$ \operatorname{trace}(S_k' C_k S_k) = \operatorname{trace}(S_k S_k' C_k) $$ Note that $S_k' C_k S_k$ is $M \times M$, whereas $S_k S_k' C_k$ is $K \times K$.