Skip to content

Commit

Permalink
add method for ev < 0
Browse files Browse the repository at this point in the history
  • Loading branch information
gboehl committed Feb 9, 2023
1 parent c705fc6 commit 3175509
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions econpizza/utilities/newton.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,13 @@ def check_status(err, cnt, maxit, tol):

# exit causes
if err < tol:
r = True, (True, "The solution converged.")
return True, (True, "The solution converged.")
elif jnp.isnan(err):
r = True, (False, "Function returns 'NaN's.")
return True, (False, "Function returns 'NaN's.")
elif cnt > maxit:
r = True, (False, f"Maximum number of {maxit} iterations reached.")
return True, (False, f"Maximum number of {maxit} iterations reached.")
else:
r = False, (False, "")
return r

# return False, (False, "")
return False, (False, "")


def newton_for_jvp(jvp_func, jacobian, x_init, verbose, tol=1e-8, maxit=200, nsteps=2, factor=1.5):
Expand Down

0 comments on commit 3175509

Please sign in to comment.