Commit 4855ce88 authored by Reimar Heinrich Leike's avatar Reimar Heinrich Leike

sneaking in a little change such that the tolerance is independant of the dimension

parent a2c29670
......@@ -83,7 +83,7 @@ def check_value_gradient_consistency(E, tol=1e-8, ntries=100):
dirder = Emid.gradient(dir)/dirnorm
numgrad = (E2.value-val)/dirnorm
if isinstance(E, Model):
xtol = tol*dirder.norm()
xtol = tol * dirder.norm() / np.sqrt(dirder.size)
if (abs(numgrad-dirder) < xtol).all():
break
else:
......
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