Commit 081deabf authored by Martin Reinecke's avatar Martin Reinecke

more cleanups

parent d3e0dbec
......@@ -196,7 +196,8 @@ class _ConstCollector(object):
self._nc |= set(fulldom.keys()) - set(const.keys())
if self._const is None:
self._const = MultiField.from_dict(
{key: const[key] for key in const.keys() if key not in self._nc})
{key: const[key]
for key in const.keys() if key not in self._nc})
else:
self._const = self._const.unite(const)
self._const = MultiField.from_dict(
......
......@@ -296,15 +296,13 @@ class _PartialExtractor(LinearOperator):
raise TypeError("MultiDomain expected")
self._domain = domain
self._target = target
for key in self._target.keys():
if not (self._domain[key] is not self._target[key]):
raise ValueError("domain mismatch")
self._capability = self.TIMES | self.ADJOINT_TIMES
def apply(self, x, mode):
self._check_input(x, mode)
if mode == self.TIMES:
res = x.extract(self._target)
assert res.domain is self.target
return res
fld = {key: x[key] if key in x.domain.keys() else Field.full(self._domain[key], 0.)
for key in self._domain.keys()}
assert MultiField.from_dict(fld).domain is self.domain
return MultiField.from_dict(fld)
return x.extract(self._target)
return MultiField.from_dict({key: x[key] for key in x.domain.keys()})
......@@ -202,8 +202,8 @@ class SumOperator(LinearOperator):
return "SumOperator:\n"+indent(subs)
def _simplify_for_constant_input_nontrivial(self, c_inp):
f=[]
o=[]
f = []
o = []
for op in self._ops:
tf, to = op.simplify_for_constant_input(
c_inp.extract_part(op.domain))
......
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