Commit fb53b84a authored by theos's avatar theos
Browse files

steepest_descent_new: the callback function can now stop the Iteration by...

steepest_descent_new: the callback function can now stop the Iteration by raising a StopIteration exception.
parent a386488b
......@@ -857,7 +857,10 @@ class quasi_newton_minimizer(object):
step_length = 0
for i in xrange(limii):
if self.callback is not None:
self.callback(self.x, i)
try:
self.callback(self.x, f_k, i)
except StopIteration:
break
# compute the the gradient for the current x
gradient = self.fprime(self.x)
......
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