Permalink
Browse files

BUG: optimize: add a NaN check in scalar_search_wolfe1 to prevent inf…

…inite loop
  • Loading branch information...
1 parent acf6061 commit e741dfc4852544bb724bea1022dbc2eefd2df8f3 @johannct johannct committed with rgommers Oct 25, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 scipy/optimize/linesearch.py
@@ -145,7 +145,7 @@ def scalar_search_wolfe1(phi, derphi, phi0=None, old_phi0=None, derphi0=None,
stp, phi1, derphi1, task = minpack2.dcsrch(alpha1, phi1, derphi1,
c1, c2, xtol, task,
amin, amax, isave, dsave)
- if task[:2] == asbytes('FG'):
+ if task[:2] == asbytes('FG') and not np.isnan(phi1):
alpha1 = stp
phi1 = phi(stp)
derphi1 = derphi(stp)

0 comments on commit e741dfc

Please sign in to comment.