Commit 9b06ed3a authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cleanup

parent 816d3fab
...@@ -63,36 +63,24 @@ class ScalingOperator(EndomorphicOperator): ...@@ -63,36 +63,24 @@ class ScalingOperator(EndomorphicOperator):
def apply(self, x, mode): def apply(self, x, mode):
self._check_input(x, mode) self._check_input(x, mode)
fct = self._factor
if self._factor == 1.: if fct == 1.:
return x return x
if self._factor == 0.: if fct == 0.:
return full(self.domain, 0.) return full(self.domain, 0.)
if (mode & 10) != 0:
if mode == self.TIMES: fct = np.conj(fct)
return x*self._factor if (mode & 12) != 0:
elif mode == self.ADJOINT_TIMES: fct = 1./fct
return x*np.conj(self._factor) return x*fct
elif mode == self.INVERSE_TIMES:
return x*(1./self._factor)
else:
return x*(1./np.conj(self._factor))
def _flip_modes(self, trafo): def _flip_modes(self, trafo):
ADJ = self.ADJOINT_BIT fct = self._factor
INV = self.INVERSE_BIT if trafo & self.ADJOINT_BIT:
fct = np.conj(fct)
if trafo == 0: if trafo & self.INVERSE_BIT:
return self fct = 1./fct
if trafo == ADJ and not np.iscomplex(self._factor): return ScalingOperator(fct, self._domain)
return self
if trafo == ADJ:
return ScalingOperator(np.conj(self._factor), self._domain)
elif trafo == INV:
return ScalingOperator(1./self._factor, self._domain)
elif trafo == ADJ | INV:
return ScalingOperator(1./np.conj(self._factor), self._domain)
raise ValueError("invalid operator transformation")
@property @property
def domain(self): def domain(self):
......
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