Commit 494068cf authored by Martin Reinecke's avatar Martin Reinecke

fixes

parent 56c8445b
...@@ -168,9 +168,10 @@ def check_value_gradient_metric_consistency2(op, loc, tol=1e-8, ntries=100): ...@@ -168,9 +168,10 @@ def check_value_gradient_metric_consistency2(op, loc, tol=1e-8, ntries=100):
dirder = linmid.jac(dir)/dirnorm dirder = linmid.jac(dir)/dirnorm
numgrad = (lin2.val-val)/dirnorm numgrad = (lin2.val-val)/dirnorm
dgrad = linmid.metric(dir)/dirnorm dgrad = linmid.metric(dir)/dirnorm
dgrad2 = (lin2.gradient-lin.gradient)/dirnorm
xtol = tol * dirder.norm() / np.sqrt(dirder.size) xtol = tol * dirder.norm() / np.sqrt(dirder.size)
if ((abs(numgrad-dirder) <= xtol).all() and if ((abs(numgrad-dirder) <= xtol).all() and
(abs(dgrad-dirder) <= xtol).all()): (abs(dgrad-dgrad2) <= xtol).all()):
break break
dir = dir*0.5 dir = dir*0.5
dirnorm *= 0.5 dirnorm *= 0.5
......
...@@ -45,7 +45,7 @@ class NullOperator(LinearOperator): ...@@ -45,7 +45,7 @@ class NullOperator(LinearOperator):
if isinstance(dom, DomainTuple): if isinstance(dom, DomainTuple):
return Field.full(dom, 0) return Field.full(dom, 0)
else: else:
return MultiField(dom, (None,)*len(dom)) return MultiField.full(dom, 0)
def apply(self, x, mode): def apply(self, x, mode):
self._check_input(x, mode) self._check_input(x, mode)
......
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