summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-03-28 16:00:10 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2019-03-28 16:00:10 +0000
commitbb8d70e564139b10ce0a3eae327f0b5f91c38368 (patch)
treef0fdd36c533355ae903a345f83ea7379186ba706 /Wrappers
parenta2c82a21f4cc498fd8f7cd8a8a1256f10524df14 (diff)
downloadframework-bb8d70e564139b10ce0a3eae327f0b5f91c38368.tar.gz
framework-bb8d70e564139b10ce0a3eae327f0b5f91c38368.tar.bz2
framework-bb8d70e564139b10ce0a3eae327f0b5f91c38368.tar.xz
framework-bb8d70e564139b10ce0a3eae327f0b5f91c38368.zip
added docstring to Function
Diffstat (limited to 'Wrappers')
-rw-r--r--Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py b/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py
index 89dd9eb..21cd82b 100644
--- a/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py
+++ b/Wrappers/Python/ccpi/optimisation/functions/BlockFunction.py
@@ -12,16 +12,30 @@ from ccpi.optimisation.functions import Function
from ccpi.framework import BlockDataContainer
class BlockFunction(Function):
- '''missing docstring'''
- def __init__(self, operator, *functions):
- '''missing docstring'''
+ '''A Block vector of Functions
+
+ .. math::
+
+ f = [f_1,f_2,f_3]
+ f([x_1,x_2,x_3]) = f_1(x_1) + f_2(x_2) + f_3(x_3)
+
+ '''
+ def __init__(self, *functions):
+ '''Creator'''
self.functions = functions
self.length = len(self.functions)
super(BlockFunction, self).__init__()
def __call__(self, x):
- '''missing docstring'''
+ '''evaluates the BlockFunction on the BlockDataContainer
+
+ :param: x (BlockDataContainer): must have as many rows as self.length
+
+ returns sum(f_i(x_i))
+ '''
+ if self.length != x.shape[0]:
+ raise ValueError('BlockFunction and BlockDataContainer have incompatible size')
t = 0
for i in range(x.shape[0]):
t += self.functions[i](x.get_item(i))
@@ -52,5 +66,5 @@ class BlockFunction(Function):
return BlockDataContainer(*out)
def gradient(self,x, out=None):
- '''missing docstring'''
+ '''gradient returns pass'''
pass \ No newline at end of file