def _linesearch_powell(func, p, xi, tol=0.001):
 def myfunc(alpha):
  return func((p + (alpha * xi)))
 (alpha_min, fret, iter, num) = brent(myfunc, full_output=1, tol=tol)
 xi = (alpha_min * xi)
 return (squeeze(fret), (p + xi), xi)

def _linesearch_powell ( func , p , xi , tol = 0.001 ) : def myfunc ( alpha ) : return func ( ( p + ( alpha * xi ) ) ) ( alpha_min , fret , iter , num ) = brent ( myfunc , full_output = 1 , tol = tol ) xi = ( alpha_min * xi ) return ( squeeze ( fret ) , ( p + xi ) , xi )
line-search algorithm using fminbound .