Commit 19fbc7e0 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'simple_scaling' into 'NIFTy_5'

allow multiplying operators with scalars

See merge request ift/nifty-dev!146
parents bc4ef0dd 693f4d4d
......@@ -59,9 +59,11 @@ class Operator(NiftyMetaBase()):
return _OpChain.make((self, x))
def __mul__(self, x):
if not isinstance(x, Operator):
return NotImplemented
return _OpProd(self, x)
if isinstance(x, Operator):
return _OpProd(self, x)
if np.isscalar(x):
return self.scale(x)
return NotImplemented
def __add__(self, x):
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