Orthogonalization of a compact-group representation (source code)

= Orthogonalization of a compact-group representation

For a continuous real representation $\rho:G\to GL(V)$ of a compact group, average any positive-definite real inner product against normalized <Haar measure>:
$$
(v,w)_G=\int_G(\rho(g)v,\rho(g)w)\,dg.
$$
The result is positive definite and $G$-invariant. An orthonormal basis for it conjugates the representation into an <orthogonal group>.