diff options
author | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-02 13:12:25 +0100 |
---|---|---|
committer | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-02 13:12:25 +0100 |
commit | 42d01d8f150fd893509a408e233ad0b19480b22d (patch) | |
tree | 653b14517ac7ab371a7be61ae8b7b1ea5b019f7f /Wrappers/Python | |
parent | ab2d7b0f23c1851ab85203583d8cdff0b2b8341f (diff) | |
download | framework-42d01d8f150fd893509a408e233ad0b19480b22d.tar.gz framework-42d01d8f150fd893509a408e233ad0b19480b22d.tar.bz2 framework-42d01d8f150fd893509a408e233ad0b19480b22d.tar.xz framework-42d01d8f150fd893509a408e233ad0b19480b22d.zip |
add old pdhg, test gap
Diffstat (limited to 'Wrappers/Python')
-rw-r--r-- | Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py | 7 | ||||
-rw-r--r-- | Wrappers/Python/wip/test_pdhg_gap.py | 31 |
2 files changed, 25 insertions, 13 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py b/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py index 8600e07..1229c4e 100644 --- a/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py +++ b/Wrappers/Python/ccpi/optimisation/algorithms/PDHG.py @@ -72,9 +72,10 @@ class PDHG(Algorithm): self.xbar *= self.theta self.xbar += self.x - self.x_old.fill(self.x) - self.y_old.fill(self.y) - #self.y_old = y.copy() +# self.x_old.fill(self.x) +# self.y_old.fill(self.y) + self.y_old = self.y.copy() + self.x_old = self.x.copy() #self.y = self.y_old def update_objective(self): diff --git a/Wrappers/Python/wip/test_pdhg_gap.py b/Wrappers/Python/wip/test_pdhg_gap.py index b196e36..6c7ccc9 100644 --- a/Wrappers/Python/wip/test_pdhg_gap.py +++ b/Wrappers/Python/wip/test_pdhg_gap.py @@ -102,22 +102,33 @@ pdhg = PDHG(f=f,g=g,operator=operator, tau=tau, sigma=sigma) pdhg.max_iteration = 2000 pdhg.update_objective_interval = 100 -#pdhg.run(5000) +pdhg.run(5000) +#%% opt = {'niter':2000} res = PDHG_old(f, g, operator, tau = tau, sigma = sigma, opt = opt) #%% -#sol = pdhg.get_output().as_array() -#fig = plt.figure() -#plt.subplot(1,2,1) -#plt.imshow(noisy_data.as_array()) -##plt.colorbar() -#plt.subplot(1,2,2) -#plt.imshow(sol) -##plt.colorbar() -#plt.show() +sol = pdhg.get_output().as_array() +sol_old = res[0].as_array() +fig = plt.figure(figsize=(20,10)) +plt.subplot(1,3,1) +plt.imshow(noisy_data.as_array()) +#plt.colorbar() +plt.subplot(1,3,2) +plt.imshow(sol) +#plt.colorbar() + +plt.subplot(1,3,3) +plt.imshow(sol_old) +plt.show() + +plt.imshow(np.abs(sol-sol_old)) +plt.colorbar() +plt.show() + + # # ##%% |