From 9f1eb505166448a1f3b523d5c822de76f648e9ab Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Fri, 15 Mar 2019 10:24:26 +0000 Subject: [PATCH] update Norm2sq for SIRF compatibility (#222) --- Wrappers/Python/ccpi/optimisation/funcs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Wrappers/Python/ccpi/optimisation/funcs.py b/Wrappers/Python/ccpi/optimisation/funcs.py index 9b9fc36c0..47ee81010 100755 --- a/Wrappers/Python/ccpi/optimisation/funcs.py +++ b/Wrappers/Python/ccpi/optimisation/funcs.py @@ -166,8 +166,13 @@ def __call__(self,x): #else: y = self.A.direct(x) y.__isub__(self.b) - y.__imul__(y) - return y.sum() * self.c + #y.__imul__(y) + #return y.sum() * self.c + try: + return y.squared_norm() * self.c + except AttributeError as ae: + # added for compatibility with SIRF + return (y.norm()**2) * self.c def gradient(self, x, out = None): if self.memopt: