summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-04-16 16:45:40 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2019-04-16 16:45:40 +0100
commit38cbce611ebe35cf803ccfc269d13e874fcf7bec (patch)
tree1e60e0b694ef14e3360379761c9af8e20762c08e /Wrappers
parentcdacb8f7421acfa7df6178843478ba23fe5d840f (diff)
downloadframework-38cbce611ebe35cf803ccfc269d13e874fcf7bec.tar.gz
framework-38cbce611ebe35cf803ccfc269d13e874fcf7bec.tar.bz2
framework-38cbce611ebe35cf803ccfc269d13e874fcf7bec.tar.xz
framework-38cbce611ebe35cf803ccfc269d13e874fcf7bec.zip
fix L2NormSquared
Diffstat (limited to 'Wrappers')
-rw-r--r--Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py4
-rw-r--r--Wrappers/Python/test/test_functions.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py b/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py
index 1946d67..2bb4ca7 100644
--- a/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py
+++ b/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py
@@ -93,8 +93,8 @@ class L2NormSquared(Function):
if self.b is None:
return x/(1+2*tau)
else:
- tmp = x
- tmp -= self.b
+ tmp = x.subtract(self.b)
+ #tmp -= self.b
tmp /= (1+2*tau)
tmp += self.b
return tmp
diff --git a/Wrappers/Python/test/test_functions.py b/Wrappers/Python/test/test_functions.py
index 7d68019..530cd21 100644
--- a/Wrappers/Python/test/test_functions.py
+++ b/Wrappers/Python/test/test_functions.py
@@ -99,6 +99,7 @@ class TestFunction(unittest.TestCase):
def test_L2NormSquared(self):
# TESTS for L2 and scalar * L2
+ print ("Test L2NormSquared")
M, N, K = 2,3,5
ig = ImageGeometry(voxel_num_x=M, voxel_num_y = N, voxel_num_z = K)
@@ -324,7 +325,7 @@ class TestFunction(unittest.TestCase):
a1 = f_no_scaled(U)
a2 = f_scaled(U)
- self.assertNumpyArrayAlmostEqual(a1.as_array(),a2.as_array())
+ self.assertNumpyArrayAlmostEqual(a1,a2)
tmp = [ el**2 for el in U.containers ]