diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-03-15 10:24:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-15 10:24:26 +0000 |
commit | 9f1eb505166448a1f3b523d5c822de76f648e9ab (patch) | |
tree | 402f7a9b43f65dbc75253ba905b917b6aff92347 | |
parent | 03ad730071bb772c3cc9c65ebb1b8f5c0136e391 (diff) | |
download | framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.tar.gz framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.tar.bz2 framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.tar.xz framework-9f1eb505166448a1f3b523d5c822de76f648e9ab.zip |
update Norm2sq for SIRF compatibility (#222)
-rwxr-xr-x | Wrappers/Python/ccpi/optimisation/funcs.py | 9 |
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: |