Method of generalized gradient descent