Security note for users of the third-party Codecov tool: https://about.codecov.io/security-update/

Commit 515c7f38 authored by Martin Reinecke's avatar Martin Reinecke

try to avoid crashes in the line searcher

parent a6bbaa1e
Pipeline #77209 passed with stages
in 12 minutes and 9 seconds
......@@ -209,8 +209,16 @@ class LineSearch(metaclass=NiftyMeta):
if alpha1 == 0:
return le_0.energy, False
le_alpha1 = le_0.at(alpha1)
phi_alpha1 = le_alpha1.value
try:
le_alpha1 = le_0.at(alpha1)
phi_alpha1 = le_alpha1.value
except FloatingPointError: # backtrack
alpha1 = (alpha0+alpha1)/2
continue # next iteration
if np.isinf(phi_alpha1) or np.isnan(phi_alpha1): # also backtrack
alpha1 = (alpha0+alpha1)/2
continue # next iteration
if (phi_alpha1 > phi_0 + self.c1*alpha1*phiprime_0) or \
((phi_alpha1 >= phi_alpha0) and (iteration_number > 1)):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment