def fmin_ncg(f, x0, fprime, fhess_p=None, fhess=None, args=(), avextol=1e-05, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, callback=None):
 opts = {'xtol': avextol, 'eps': epsilon, 'maxiter': maxiter, 'disp': disp, 'return_all': retall}
 res = _minimize_newtoncg(f, x0, args, fprime, fhess, fhess_p, callback=callback, **opts)
 if full_output:
  retlist = (res['x'], res['fun'], res['nfev'], res['njev'], res['nhev'], res['status'])
  if retall:
   retlist += (res['allvecs'],)
  return retlist
 elif retall:
  return (res['x'], res['allvecs'])
 else:
  return res['x']

def fmin_ncg ( f , x0 , fprime , fhess_p = None , fhess = None , args = ( ) , avextol = 1e-05 , epsilon = _epsilon , maxiter = None , full_output = 0 , disp = 1 , retall = 0 , callback = None ) : opts = { 'xtol' : avextol , 'eps' : epsilon , 'maxiter' : maxiter , 'disp' : disp , 'return_all' : retall } res = _minimize_newtoncg ( f , x0 , args , fprime , fhess , fhess_p , callback = callback , ** opts ) if full_output : retlist = ( res [ 'x' ] , res [ 'fun' ] , res [ 'nfev' ] , res [ 'njev' ] , res [ 'nhev' ] , res [ 'status' ] ) if retall : retlist += ( res [ 'allvecs' ] , ) return retlist elif retall : return ( res [ 'x' ] , res [ 'allvecs' ] ) else : return res [ 'x' ]
unconstrained minimization of a function using the newton-cg method .