Group theory of harmonic oscillators