Commit 693f4d4d authored by Martin Reinecke's avatar Martin Reinecke

allow multiplying operators with scalars

parent bc4ef0dd
...@@ -59,9 +59,11 @@ class Operator(NiftyMetaBase()): ...@@ -59,9 +59,11 @@ class Operator(NiftyMetaBase()):
return _OpChain.make((self, x)) return _OpChain.make((self, x))
def __mul__(self, x): def __mul__(self, x):
if not isinstance(x, Operator): if isinstance(x, Operator):
return NotImplemented return _OpProd(self, x)
return _OpProd(self, x) if np.isscalar(x):
return self.scale(x)
return NotImplemented
def __add__(self, x): def __add__(self, x):
if not isinstance(x, Operator): if not isinstance(x, Operator):
......
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