...
  View open merge request
Commits (4)
......@@ -144,6 +144,24 @@ def _get_acceptable_location(op, loc, lin):
return loc2, lin2
def check_value_linearization_consistency(op, loc):
"""
Checks the value of an operator if called with or without linearization
Parameters
----------
op : Operator
Operator which shall be checked.
loc : Field or MultiField
An Field or MultiField instance which has the same domain
as op. The location at which the gradient is checked
"""
lin = op(Linearization.make_var(loc))
if (lin.val != op(loc)).any():
raise ValueError('Operator yields different results '
'when called with linearization')
def check_jacobian_consistency(op, loc, tol=1e-8, ntries=100):
"""
Checks the Jacobian of an operator against its finite difference
......