Numerical solution of nonlinear elliptic partial differential equations by a generalized conjugate gradient method