1e66efd114
After an accepted line-search step, the solver has already rebuilt the gradient and Hessian and solved for the next search direction, so the Newton decrement 0.5*g'*H^-1*g -- the quadratic model's predicted cost improvement of the next iteration -- costs one dot product. Terminating when it falls below tolerance avoids running one more iteration only to observe a correspondingly small actual improvement. This is a C port of Alain's proposal in MJWarp: https://github.com/google-deepmind/mujoco_warp/pull/1520 PiperOrigin-RevId: 947768034 Change-Id: I94e5c71a4e2b4a7775611edd1dad254bba2633b4