def fmin_bfgs(f, x0, fprime=None, args=(), gtol=1e-05, norm=Inf, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, callback=None):
 opts = {'gtol': gtol, 'norm': norm, 'eps': epsilon, 'disp': disp, 'maxiter': maxiter, 'return_all': retall}
 res = _minimize_bfgs(f, x0, args, fprime, callback=callback, **opts)
 if full_output:
  retlist = (res['x'], res['fun'], res['jac'], res['hess_inv'], res['nfev'], res['njev'], res['status'])
  if retall:
   retlist += (res['allvecs'],)
  return retlist
 elif retall:
  return (res['x'], res['allvecs'])
 else:
  return res['x']

def fmin_bfgs ( f , x0 , fprime = None , args = ( ) , gtol = 1e-05 , norm = Inf , epsilon = _epsilon , maxiter = None , full_output = 0 , disp = 1 , retall = 0 , callback = None ) : opts = { 'gtol' : gtol , 'norm' : norm , 'eps' : epsilon , 'disp' : disp , 'maxiter' : maxiter , 'return_all' : retall } res = _minimize_bfgs ( f , x0 , args , fprime , callback = callback , ** opts ) if full_output : retlist = ( res [ 'x' ] , res [ 'fun' ] , res [ 'jac' ] , res [ 'hess_inv' ] , res [ 'nfev' ] , res [ 'njev' ] , res [ 'status' ] ) if retall : retlist += ( res [ 'allvecs' ] , ) return retlist elif retall : return ( res [ 'x' ] , res [ 'allvecs' ] ) else : return res [ 'x' ]
minimize a function using the bfgs algorithm .