Nonlinear least squares gauss newton method