summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python
diff options
context:
space:
mode:
authorepapoutsellis <epapoutsellis@gmail.com>2019-04-07 22:17:08 +0100
committerepapoutsellis <epapoutsellis@gmail.com>2019-04-07 22:17:08 +0100
commit535241a9dfb6ad29a1d41d2aad737478705d5866 (patch)
treef067262e4410d75deef97824d812dee6eba150b1 /Wrappers/Python
parent213ddd3c62975184dfda95320c89db217e503170 (diff)
downloadframework-535241a9dfb6ad29a1d41d2aad737478705d5866.tar.gz
framework-535241a9dfb6ad29a1d41d2aad737478705d5866.tar.bz2
framework-535241a9dfb6ad29a1d41d2aad737478705d5866.tar.xz
framework-535241a9dfb6ad29a1d41d2aad737478705d5866.zip
fix pdgap for function composition
Diffstat (limited to 'Wrappers/Python')
-rw-r--r--Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py b/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py
index 7c6bc8a..94b0bde 100644
--- a/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py
+++ b/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py
@@ -12,6 +12,7 @@ import matplotlib.pyplot as plt
import time
from ccpi.optimisation.operators import BlockOperator
from ccpi.framework import BlockDataContainer
+from ccpi.optimisation.functions import FunctionOperatorComposition
import matplotlib.pyplot as plt
@@ -138,9 +139,10 @@ def PDHG_old(f, g, operator, tau = None, sigma = None, opt = None, **kwargs):
x_old = x
y_old = y
-# if i%100==0:
-
- p1 = f(operator.direct(x)) + g(x)
+# if isinstance(f, FunctionOperatorComposition):
+ p1 = f(x) + g(x)
+# else:
+# p1 = f(operator.direct(x)) + g(x)
d1 = -(f.convex_conjugate(y) + g(-1*operator.adjoint(y)))
pd1 = p1 - d1
@@ -148,12 +150,12 @@ def PDHG_old(f, g, operator, tau = None, sigma = None, opt = None, **kwargs):
dual.append(d1)
pdgap.append(pd1)
-
-# print( i, primal, dual, primal-dual)
-
-# plt.imshow(x.as_array())
-# plt.show()
-# print(f(operator.direct(x)) + g(x), i)
+ if i%100==0:
+ print(p1, d1, pd1)
+# if isinstance(f, FunctionOperatorComposition):
+# p1 = f(x) + g(x)
+# else:
+
t_end = time.time()