summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorepapoutsellis <epapoutsellis@gmail.com>2019-05-10 13:47:39 +0100
committerepapoutsellis <epapoutsellis@gmail.com>2019-05-10 13:47:39 +0100
commitdd4a215c7ed2d9013ec3488401ec3219972de5dd (patch)
tree4a8d7210d60a9f06a363a080ba2b4773453952cc /Wrappers
parent8d5d2dc372c479347989a16622542378ce6b1eca (diff)
downloadframework-dd4a215c7ed2d9013ec3488401ec3219972de5dd.tar.gz
framework-dd4a215c7ed2d9013ec3488401ec3219972de5dd.tar.bz2
framework-dd4a215c7ed2d9013ec3488401ec3219972de5dd.tar.xz
framework-dd4a215c7ed2d9013ec3488401ec3219972de5dd.zip
fix methods IndBox
Diffstat (limited to 'Wrappers')
-rwxr-xr-xWrappers/Python/ccpi/optimisation/functions/IndicatorBox.py35
1 files changed, 14 insertions, 21 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/IndicatorBox.py b/Wrappers/Python/ccpi/optimisation/functions/IndicatorBox.py
index dd2162c..6c18ebf 100755
--- a/Wrappers/Python/ccpi/optimisation/functions/IndicatorBox.py
+++ b/Wrappers/Python/ccpi/optimisation/functions/IndicatorBox.py
@@ -84,39 +84,32 @@ if __name__ == '__main__':
ig = ImageGeometry(voxel_num_x = N, voxel_num_y = M)
u = ig.allocate('random_int')
- tau = 10
+ tau = 2
f = IndicatorBox(2, 3)
lower = 10
upper = 30
+
+ z1 = f.proximal(u, tau)
- x = u
+ z2 = f.proximal_conjugate(u/tau, 1/tau)
- z1 = (x.maximum(lower)).minimum(upper)
+ z = z1 + tau * z2
- z2 = x - tau * ((x/tau).maximum(lower)).minimum(upper)
+ numpy.testing.assert_array_equal(z.as_array(), u.as_array())
+
+ out1 = ig.allocate()
+ out2 = ig.allocate()
- z = z1 + z2/tau
+ f.proximal(u, tau, out=out1)
+ f.proximal_conjugate(u/tau, 1/tau, out = out2)
- print(z.array, x.array)
+ p = out1 + tau * out2
+ numpy.testing.assert_array_equal(p.as_array(), u.as_array())
-# prox = f.proximal(u, tau)
-# prox_conj = f.proximal_conjugate(u/tau, tau)
-#
-#
-# z = prox + tau * prox_conj
-# print(z.as_array(), u.array)
-# x - tau * ((x/tau).maximum(self.lower)).minimum(self.upper) +
-
-
-
-
-
-
-
-
+ \ No newline at end of file