summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-03-15 10:24:26 +0000
committerGitHub <noreply@github.com>2019-03-15 10:24:26 +0000
commit9f1eb505166448a1f3b523d5c822de76f648e9ab (patch)
tree402f7a9b43f65dbc75253ba905b917b6aff92347
parent03ad730071bb772c3cc9c65ebb1b8f5c0136e391 (diff)
downloadframework-9f1eb505166448a1f3b523d5c822de76f648e9ab.tar.gz
framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.tar.bz2
framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.tar.xz
framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.zip
update Norm2sq for SIRF compatibility (#222)
-rwxr-xr-xWrappers/Python/ccpi/optimisation/funcs.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/funcs.py b/Wrappers/Python/ccpi/optimisation/funcs.py
index 9b9fc36..47ee810 100755
--- a/Wrappers/Python/ccpi/optimisation/funcs.py
+++ b/Wrappers/Python/ccpi/optimisation/funcs.py
@@ -166,8 +166,13 @@ class Norm2sq(Function):
#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: