Efficient implementation of an algebra of polynomial-times-Gaussian functions