From d304f819bdb9dbd61575a5dcad0d83d877ecfa01 Mon Sep 17 00:00:00 2001 From: Martin Reinecke <martin@mpa-garching.mpg.de> Date: Thu, 27 Sep 2018 15:07:59 +0200 Subject: [PATCH] try to support operator subtraction --- nifty5/operators/operator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nifty5/operators/operator.py b/nifty5/operators/operator.py index dbc8cd387..efcd926d5 100644 --- a/nifty5/operators/operator.py +++ b/nifty5/operators/operator.py @@ -57,6 +57,11 @@ class Operator(NiftyMetaBase()): return NotImplemented return _OpSum(self, x) + def __sub__(self, x): + if not isinstance(x, Operator): + return NotImplemented + return _OpSum(self, -x) + def __pow__(self, power): if not np.isscalar(power): return NotImplemented -- GitLab