Commit de87751b authored by Philipp Arras's avatar Philipp Arras
Browse files


parent 19ab4fa3
......@@ -324,20 +324,20 @@ class MultiField(object):
val = tuple(f(v1, other) for v1 in self._val)
return MultiField(self._domain, val)
def _sinc_withjac(self):
return self._nontrivial_jac_helper('_sinc_withjac')
def _absolute_withjac(self):
return self._nontrivial_jac_helper('_absolute_withjac')
def _nontrivial_jac_helper(self, funcname):
for op in ["sinc", "absolute"]:
ss = f'_{op}_withjac'
def func(ss):
def func2(self):
val = self.to_dict()
jac = {}
for kk, vv in val.items():
val[kk], jac[kk] = getattr(vv, funcname)()
val[kk], jac[kk] = getattr(vv, ss)()
val = MultiField.from_dict(val, self._domain)
jac = MultiField.from_dict(jac, self._domain)
return val, jac
return func2
setattr(MultiField, ss, func(ss))
for op in ["__add__", "__radd__",
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