Solution (source code)

= Solution

For equal irreducible <group representations>, the intertwining identity and the complex <Schur's lemma> give $T=cI_n$. Conjugation preserves <trace>, so
$$
\operatorname{tr}T=\sum_{g\in G}\operatorname{tr}(D_1(g)BD_1(g)^{-1})=|G|\operatorname{tr}B.
$$
Since $\operatorname{tr}(cI_n)=nc$, we obtain
$$
\boxed{T=\frac{|G|\operatorname{tr}B}{n}I_n.}
$$