Commit c803a3ec authored by Martin Reinecke's avatar Martin Reinecke

efficiency tweaks

parent 151d7b24
Pipeline #24505 passed with stage
in 6 minutes and 41 seconds
...@@ -99,6 +99,14 @@ class ChainOperator(LinearOperator): ...@@ -99,6 +99,14 @@ class ChainOperator(LinearOperator):
def target(self): def target(self):
return self._ops[0].target return self._ops[0].target
@property
def inverse(self):
return self.make([op.inverse for op in reversed(self._ops)])
@property
def adjoint(self):
return self.make([op.adjoint for op in reversed(self._ops)])
@property @property
def capability(self): def capability(self):
return self._capability return self._capability
......
...@@ -81,8 +81,7 @@ class ScalingOperator(EndomorphicOperator): ...@@ -81,8 +81,7 @@ class ScalingOperator(EndomorphicOperator):
def capability(self): def capability(self):
if self._factor == 0.: if self._factor == 0.:
return self.TIMES | self.ADJOINT_TIMES return self.TIMES | self.ADJOINT_TIMES
return (self.TIMES | self.ADJOINT_TIMES | return self._all_ops
self.INVERSE_TIMES | self.ADJOINT_INVERSE_TIMES)
def draw_sample(self): def draw_sample(self):
return Field.from_random(random_type="normal", return Field.from_random(random_type="normal",
......
...@@ -122,6 +122,10 @@ class SumOperator(LinearOperator): ...@@ -122,6 +122,10 @@ class SumOperator(LinearOperator):
def target(self): def target(self):
return self._ops[0].target return self._ops[0].target
@property
def adjoint(self):
return self.make([op.adjoint for op in self._ops], self._neg)
@property @property
def capability(self): def capability(self):
return self._capability return self._capability
......
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