From 27ea6509eaa294529c86567bf50def2d27966bb7 Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Thu, 21 Mar 2019 16:23:14 +0000 Subject: add Vaggelis fix, missing docstrings are added --- .../ccpi/optimisation/functions/BlockFunction.py | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py b/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py index d6c98c4..89dd9eb 100644 --- a/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py +++ b/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py @@ -12,45 +12,31 @@ from ccpi.optimisation.functions import Function from ccpi.framework import BlockDataContainer class BlockFunction(Function): - + '''missing docstring''' def __init__(self, operator, *functions): - + '''missing docstring''' self.functions = functions - self.operator = operator self.length = len(self.functions) super(BlockFunction, self).__init__() def __call__(self, x): - - tmp = self.operator.direct(x) - + '''missing docstring''' t = 0 - for i in range(tmp.shape[0]): - t += self.functions[i](tmp.get_item(i)) + for i in range(x.shape[0]): + t += self.functions[i](x.get_item(i)) return t - def call_adjoint(self, x): - - tmp = operator.adjoint(x) - - t = 0 - for i in range(tmp.shape[0]): - t += self.functions[i](tmp.get_item(i)) - return t - def convex_conjugate(self, x): - - ''' Convex_conjugate does not take into account the BlockOperator''' + '''Convex_conjugate does not take into account the BlockOperator''' t = 0 for i in range(x.shape[0]): - t += self.functions[i].convex_conjugate(x.get_item(i)) + t += self.functions[i].convex_conjugate(x.get_item(i)) return t def proximal_conjugate(self, x, tau, out = None): - - ''' proximal_conjugate does not take into account the BlockOperator''' + '''proximal_conjugate does not take into account the BlockOperator''' out = [None]*self.length for i in range(self.length): out[i] = self.functions[i].proximal_conjugate(x.get_item(i), tau) @@ -58,8 +44,7 @@ class BlockFunction(Function): return BlockDataContainer(*out) def proximal(self, x, tau, out = None): - - ''' proximal does not take into account the BlockOperator''' + '''proximal does not take into account the BlockOperator''' out = [None]*self.length for i in range(self.length): out[i] = self.functions[i].proximal(x.get_item(i), tau) @@ -67,4 +52,5 @@ class BlockFunction(Function): return BlockDataContainer(*out) def gradient(self,x, out=None): + '''missing docstring''' pass \ No newline at end of file -- cgit v1.2.3