summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-04-11 12:03:45 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2019-04-11 12:03:53 +0100
commit2415b5a334d3bdf87fec47ca3ec290a6602ee13c (patch)
treebe3a52c0b7166024e4829b8c6350e36198114f0e
parent3ff8a543fb4ef59179ce3490bc28b8f61bf979ac (diff)
downloadframework-2415b5a334d3bdf87fec47ca3ec290a6602ee13c.tar.gz
framework-2415b5a334d3bdf87fec47ca3ec290a6602ee13c.tar.bz2
framework-2415b5a334d3bdf87fec47ca3ec290a6602ee13c.tar.xz
framework-2415b5a334d3bdf87fec47ca3ec290a6602ee13c.zip
set to zero the output variable on input if memopt
-rw-r--r--Wrappers/Python/ccpi/optimisation/operators/GradientOperator.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/operators/GradientOperator.py b/Wrappers/Python/ccpi/optimisation/operators/GradientOperator.py
index 9c639df..d655653 100644
--- a/Wrappers/Python/ccpi/optimisation/operators/GradientOperator.py
+++ b/Wrappers/Python/ccpi/optimisation/operators/GradientOperator.py
@@ -65,19 +65,19 @@ class Gradient(LinearOperator):
def adjoint(self, x, out=None):
if out is not None:
-
tmp = self.gm_domain.allocate()
for i in range(x.shape[0]):
self.FD.direction=self.ind[i]
self.FD.adjoint(x.get_item(i), out = tmp)
-# FiniteDiff(self.gm_domain, direction = self.ind[i], bnd_cond = self.bnd_cond).adjoint(x.get_item(i), out=tmp)
- out+=tmp
+ if i == 0:
+ out.fill(tmp)
+ else:
+ out += tmp
else:
tmp = self.gm_domain.allocate()
for i in range(x.shape[0]):
self.FD.direction=self.ind[i]
- tmp+=self.FD.adjoint(x.get_item(i))
-# tmp+=FiniteDiff(self.gm_domain, direction = self.ind[i], bnd_cond = self.bnd_cond).adjoint(x.get_item(i))
+ tmp += self.FD.adjoint(x.get_item(i))
return tmp