def _root_leastsq(func, x0, args=(), jac=None, col_deriv=0, xtol=1.49012e-08, ftol=1.49012e-08, gtol=0.0, maxiter=0, eps=0.0, factor=100, diag=None, **unknown_options):
 _check_unknown_options(unknown_options)
 (x, cov_x, info, msg, ier) = leastsq(func, x0, args=args, Dfun=jac, full_output=True, col_deriv=col_deriv, xtol=xtol, ftol=ftol, gtol=gtol, maxfev=maxiter, epsfcn=eps, factor=factor, diag=diag)
 sol = OptimizeResult(x=x, message=msg, status=ier, success=(ier in (1, 2, 3, 4)), cov_x=cov_x, fun=info.pop('fvec'))
 sol.update(info)
 return sol

def _root_leastsq ( func , x0 , args = ( ) , jac = None , col_deriv = 0 , xtol = 1.49012e-08 , ftol = 1.49012e-08 , gtol = 0.0 , maxiter = 0 , eps = 0.0 , factor = 100 , diag = None , ** unknown_options ) : _check_unknown_options ( unknown_options ) ( x , cov_x , info , msg , ier ) = leastsq ( func , x0 , args = args , Dfun = jac , full_output = True , col_deriv = col_deriv , xtol = xtol , ftol = ftol , gtol = gtol , maxfev = maxiter , epsfcn = eps , factor = factor , diag = diag ) sol = OptimizeResult ( x = x , message = msg , status = ier , success = ( ier in ( 1 , 2 , 3 , 4 ) ) , cov_x = cov_x , fun = info . pop ( 'fvec' ) ) sol . update ( info ) return sol
solve for least squares with levenberg-marquardt options col_deriv : bool non-zero to specify that the jacobian function computes derivatives down the columns .