Solution (source code)

= Solution

For component $m$, stack its $N_m$ assigned observations as $y_1^{(m)},\ldots,y_{N_m}^{(m)}\in\mathbb R^n$. The prior is $f_m\sim N_n(0,K)$ and each assigned vector is conditionally $N_n(f_m,\sigma^2I_n)$. <Normal-normal conjugacy> gives
$$
f_m\mid y,c,\pi\sim N_n(\mu_m,V_m),
$$
where
$$
V_m=\left(K^{-1}+\frac{N_m}{\sigma^2}I_n\right)^{-1},
\qquad
\mu_m=V_m\frac1{\sigma^2}\sum_{r=1}^{N_m}y_r^{(m)}.
$$
If $N_m=0$, this reduces to the prior $N_n(0,K)$.