Minimal realizations and spectrum generating algebras