Riemannian optimization with a preconditioning scheme on the generalized Stiefel manifold