Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment