From 881a7702c522311bc8e860a03ecba1690c98dd32 Mon Sep 17 00:00:00 2001
From: Stephan Hilb <stephan@ecshi.net>
Date: Sun, 24 May 2020 21:19:48 +0200
Subject: [PATCH] change sign

---
 src/DualTVDD.jl | 6 +++---
 src/dualtvdd.jl | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/DualTVDD.jl b/src/DualTVDD.jl
index 89225bf..4a7cf24 100644
--- a/src/DualTVDD.jl
+++ b/src/DualTVDD.jl
@@ -35,14 +35,14 @@ function run()
 end
 
 function rundd()
-    f = zeros(8)
+    f = zeros(8,8)
     f[1,:] .= 1
     #g = [0. 2; 1 0.]
     A = diagm(ones(length(f)))
     α = 0.25
 
     md = DualTVDD.DualTVDDModel(f, A, α, 0., 0.)
-    alg = DualTVDD.DualTVDDAlgorithm(M=(2,), overlap=(2,), σ=0.25)
+    alg = DualTVDD.DualTVDDAlgorithm(M=(2,2), overlap=(2,2), σ=0.25)
     ctx = DualTVDD.init(md, alg)
 
     md2 = DualTVDD.OpROFModel(f, A, α)
@@ -50,7 +50,7 @@ function rundd()
     ctx2 = DualTVDD.init(md2, alg2)
 
 
-    for i in 1:150
+    for i in 1:1000
         step!(ctx)
         step!(ctx2)
     end
diff --git a/src/dualtvdd.jl b/src/dualtvdd.jl
index 21cc1ee..df4a0dc 100644
--- a/src/dualtvdd.jl
+++ b/src/dualtvdd.jl
@@ -69,7 +69,7 @@ function step!(ctx::DualTVDDContext)
     ax = axes(ctx.p)
     overlap = ctx.algorithm.overlap
 
-    @inline kfΛ(w) = @inbounds divergence_global(w)
+    @inline kfΛ(w) = @inbounds -divergence_global(w)
     kΛ = Kernel{ntuple(_->-1:1, d)}(kfΛ)
 
     println("global p")
@@ -83,7 +83,7 @@ function step!(ctx::DualTVDDContext)
         # g_i = (A*f - Λ(1-theta_i)p^n)|_{\Omega_i}
         # subctx[i].p is used as a buffer
 
-        tmp = (1 .- theta.(Ref(ax), Ref(sax), Ref(overlap), CartesianIndices(ctx.p))) .* ctx.p
+        tmp = .-(1 .- theta.(Ref(ax), Ref(sax), Ref(overlap), CartesianIndices(ctx.p))) .* ctx.p
         #tmp3 = .-(1 .- theta.(Ref(ax), Ref(sax), Ref(overlap), CartesianIndices(ctx.p)))
         #ctx.subctx[i].p .= .-(1 .- theta.(Ref(ax), Ref(sax), Ref(overlap), ci)) .* ctx.p[ctx.subax[i]...]
 
-- 
GitLab