Diagonalization of pp-waves