diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-04-10 17:37:20 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-04-10 17:37:20 +0100 |
commit | c20f443cb80221260e284668fad2053798f9000a (patch) | |
tree | 07e66dc0dd031ea1cb53181dca0c38259274b190 | |
parent | d1cd883ce417ae08cfc7f853377f3e17fa55be01 (diff) | |
download | framework-c20f443cb80221260e284668fad2053798f9000a.tar.gz framework-c20f443cb80221260e284668fad2053798f9000a.tar.bz2 framework-c20f443cb80221260e284668fad2053798f9000a.tar.xz framework-c20f443cb80221260e284668fad2053798f9000a.zip |
fix out
-rw-r--r-- | Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py b/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py index 81c16cd..bbf1d29 100644 --- a/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py +++ b/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py @@ -52,15 +52,25 @@ class BlockFunction(Function): def proximal_conjugate(self, x, tau, out = None): '''proximal_conjugate does not take into account the BlockOperator''' - out = [None]*self.length - if isinstance(tau, Number): - for i in range(self.length): - out[i] = self.functions[i].proximal_conjugate(x.get_item(i), tau) + if out is not None: + if isinstance(tau, Number): + for i in range(self.length): + self.functions[i].proximal_conjugate(x.get_item(i), tau, out=out.get_item(i)) + else: + for i in range(self.length): + self.functions[i].proximal_conjugate(x.get_item(i), tau.get_item(i),out=out.get_item(i)) + else: - for i in range(self.length): - out[i] = self.functions[i].proximal_conjugate(x.get_item(i), tau.get_item(i)) - - return BlockDataContainer(*out) + + out = [None]*self.length + if isinstance(tau, Number): + for i in range(self.length): + out[i] = self.functions[i].proximal_conjugate(x.get_item(i), tau) + else: + for i in range(self.length): + out[i] = self.functions[i].proximal_conjugate(x.get_item(i), tau.get_item(i)) + + return BlockDataContainer(*out) def proximal(self, x, tau, out = None): '''proximal does not take into account the BlockOperator''' |