Generalized Weyl Algebras and Their Dimensions