Commit a9b05777 authored by Reimar Leike's avatar Reimar Leike
Browse files

Make Jacobian test distinguish C and R differentiability

parent 15693c86
Pipeline #75956 failed with stages
in 13 minutes and 9 seconds
......@@ -248,7 +248,8 @@ def _linearization_value_consistency(op, loc):
assert_allclose(fld0, fld1, 0, 1e-7)
def check_jacobian_consistency(op, loc, tol=1e-8, ntries=100, perf_check=True):
def check_jacobian_consistency(op, loc, tol=1e-8, ntries=100, perf_check=True,
only_r_differentiable=True):
"""
Checks the Jacobian of an operator against its finite difference
approximation.
......@@ -297,10 +298,5 @@ def check_jacobian_consistency(op, loc, tol=1e-8, ntries=100, perf_check=True):
raise ValueError("gradient and value seem inconsistent")
loc = locnext
# FIXME The following code shows that we need prober tests for complex
# derivatives
ddtype = loc.values()[0].dtype if isinstance(loc, MultiField) else loc.dtype
tdtype = dirder.values()[0].dtype if isinstance(dirder, MultiField) else dirder.dtype
only_r_linear = ddtype != tdtype
consistency_check(linmid.jac, domain_dtype=ddtype, target_dtype=tdtype,
only_r_linear=only_r_linear)
only_r_linear=only_r_differentiable)
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