Two-way matrix optimization I have run into a problem like this. Looks a bit unusual, but I think should be doable. Find $U$ achieving
$$\min_U  \left(  \| A - UW \|_2^2 + \| RU - H \|_2^2  \right)$$
$A,U,W,R,H$ are all matrices of dimension so that the operations above make sense. All the other matrices are given, except $U$. The norm is the Frobenius norm.
The difficulty here is that $U$ is multiplied from different sides in different terms.
Any ideas?

Multiplication by a fixed matrix is a linear operator on the vector space of matrices, and can be represented in matrix-vector form using vectorization and the Kronecker product:
$${\rm vec}(AXB) = (B^T\otimes A)\,{\rm vec}(X),$$
where, if $X$ is an $m\times n$ matrix, then ${\rm vec}(X)$ is an $mn$-dimensional vector. For convenience, in the following I will denote ${\rm vec}(X)$ as $\bar X$. Of course, vectorization is linear: $\overline{X+Y} = \bar X+\bar Y$ and $\overline{aX}=a\bar X$ for scalar $a$. One can also readily verify that $\|X\|_F=\|\bar X\|$.
Then
$$\begin{align}
\|A-UW\|_F^2+\|RU-H\|_F^2 &= \|\overline{A-UW}\|^2+\|\overline{RU-H}\|^2 \\
&= \|\bar A-\overline{UW}\|^2+\|\overline{RU}-\bar H\|^2 \\
&= \|\bar A-(W^T\otimes I)\bar U\|^2+\|(I\otimes R)\bar U-\bar H\|^2 \\
\end{align}$$
which you can expand into a quadratic in $\bar U$ and minimize using linear algebra.
