summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-03-14 15:08:03 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2019-03-14 15:08:03 +0000
commit9769759d3f7f1eab53631627474eade8e4c6f96a (patch)
tree8f7f3d918da941785bc5f004694daf2ccbe1da78 /Wrappers
parent0f1b5e9ef2619eff4cc158d8e2e05a9d19b8393a (diff)
downloadframework-9769759d3f7f1eab53631627474eade8e4c6f96a.tar.gz
framework-9769759d3f7f1eab53631627474eade8e4c6f96a.tar.bz2
framework-9769759d3f7f1eab53631627474eade8e4c6f96a.tar.xz
framework-9769759d3f7f1eab53631627474eade8e4c6f96a.zip
removed FunctionComposition.py
Diffstat (limited to 'Wrappers')
-rw-r--r--Wrappers/Python/ccpi/optimisation/functions/FunctionComposition.py121
1 files changed, 0 insertions, 121 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/FunctionComposition.py b/Wrappers/Python/ccpi/optimisation/functions/FunctionComposition.py
deleted file mode 100644
index f24dc10..0000000
--- a/Wrappers/Python/ccpi/optimisation/functions/FunctionComposition.py
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-"""
-Created on Wed Mar 6 19:45:06 2019
-
-@author: evangelos
-"""
-
-import numpy as np
-#from ccpi.optimisation.funcs import Function
-from ccpi.optimisation.functions import Function
-from ccpi.framework import DataContainer, ImageData, ImageGeometry
-from ccpi.framework import BlockDataContainer
-from ccpi.optimisation.functions import BlockFunction
-
-class FunctionOperatorComposition(Function):
-
- def __init__(self, function, operator):
-
- self.function = functions
- self.operator = operator
- self.grad_Lipschitz_cnst = 2*self.function.alpha*operator.norm()**2
- super(FunctionOperatorComposition, self).__init__()
-
- def __call__(self, x):
-
- return self.function(operator.direct(x))
-
- def call_adjoint(self, x):
-
- return self.function(operator.adjoint(x))
-
- def convex_conjugate(self, x):
-
- return self.function.convex_conjugate(x)
-
- def proximal(self, x, tau):
-
- ''' proximal does not take into account the Operator'''
-
- return self.function.proximal(x, tau, out=None)
-
- def proximal_conjugate(self, x, tau):
-
- ''' proximal conjugate does not take into account the Operator'''
-
- return self.function.proximal_conjugate(x, tau, out=None)
-
- def gradient(self, x):
-
- ''' Gradient takes into account the Operator'''
-
- return self.adjoint(self.function.gradient(self.operator.direct(x)))
-
-
-
-
-
-class FunctionComposition_new(Function):
-
- def __init__(self, operator, *functions):
-
- self.functions = functions
- self.operator = operator
- self.length = len(self.functions)
-
- super(FunctionComposition_new, self).__init__()
-
- def __call__(self, x):
-
- if isinstance(x, ImageData):
- x = CompositeDataContainer(x)
-
- t = 0
- for i in range(x.shape[0]):
- t += self.functions[i](x.get_item(i))
- return t
-
- def convex_conjugate(self, x):
-
- if isinstance(x, ImageData):
- x = CompositeDataContainer(x)
-
- t = 0
- for i in range(x.shape[0]):
- t += self.functions[i].convex_conjugate(x.get_item(i))
- return t
-
- def proximal_conjugate(self, x, tau, out = None):
-
- if isinstance(x, ImageData):
- x = CompositeDataContainer(x)
-
- out = [None]*self.length
- for i in range(self.length):
- out[i] = self.functions[i].proximal_conjugate(x.get_item(i), tau)
-
- if self.length==1:
- return ImageData(*out)
- else:
- return CompositeDataContainer(*out)
-
- def proximal(self, x, tau, out = None):
-
- if isinstance(x, ImageData):
- x = CompositeDataContainer(x)
-
- out = [None]*self.length
- for i in range(self.length):
- out[i] = self.functions[i].proximal(x.get_item(i), tau)
-
- if self.length==1:
- return ImageData(*out)
- else:
- return CompositeDataContainer(*out)
-
-
-if __name__ == '__main__':
-
- from operators import Operator
- from IdentityOperator import Identity \ No newline at end of file