Commit 4b9b9815 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweaks

parent 72f9ca29
...@@ -44,10 +44,14 @@ class DomainTupleFieldInserter(LinearOperator): ...@@ -44,10 +44,14 @@ class DomainTupleFieldInserter(LinearOperator):
tgt.insert(index, new_space) tgt.insert(index, new_space)
self._target = DomainTuple.make(tgt) self._target = DomainTuple.make(tgt)
self._capability = self.TIMES | self.ADJOINT_TIMES self._capability = self.TIMES | self.ADJOINT_TIMES
fst_dims = sum([len(dd.shape) for dd in self.domain][:index]) fst_dims = sum(len(dd.shape) for dd in self.domain[:index])
last_dims = len(self.domain.shape) - fst_dims nshp = new_space.shape
self._slc = (slice(None),)*fst_dims + position + ( if len(position) != len(nshp):
slice(None),)*last_dims raise ValueError("shape mismatch between new_space and position")
for s, p in zip(nshp, position):
if p < 0 or p >= s:
raise ValueError("bad position value")
self._slc = (slice(None),)*fst_dims + position
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