summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python
diff options
context:
space:
mode:
authorTomas Kulhanek <tomas.kulhanek@stfc.ac.uk>2019-01-28 13:18:49 +0000
committerGitHub <noreply@github.com>2019-01-28 13:18:49 +0000
commited7c78377ef03c185f2fce7435742c5dc6d105e7 (patch)
treec4840113c121a9ca52ce112136e8dca86e629d66 /Wrappers/Python
parente9afcd85fa33d644c89feb3dfd60f3ddf3ecbbeb (diff)
parentba9994e131dae1e1c09f156df12327f2ef10beb4 (diff)
downloadframework-ed7c78377ef03c185f2fce7435742c5dc6d105e7.tar.gz
framework-ed7c78377ef03c185f2fce7435742c5dc6d105e7.tar.bz2
framework-ed7c78377ef03c185f2fce7435742c5dc6d105e7.tar.xz
framework-ed7c78377ef03c185f2fce7435742c5dc6d105e7.zip
Merge branch 'master' into master
Diffstat (limited to 'Wrappers/Python')
-rwxr-xr-xWrappers/Python/ccpi/optimisation/funcs.py16
-rw-r--r--Wrappers/Python/conda-recipe/conda_build_config.yaml2
2 files changed, 11 insertions, 7 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/funcs.py b/Wrappers/Python/ccpi/optimisation/funcs.py
index db00e9f..c7a6143 100755
--- a/Wrappers/Python/ccpi/optimisation/funcs.py
+++ b/Wrappers/Python/ccpi/optimisation/funcs.py
@@ -38,7 +38,7 @@ def isSizeCorrect(data1 ,data2):
class Function(object):
def __init__(self):
- pass
+ self.L = None
def __call__(self,x, out=None): raise NotImplementedError
def grad(self, x): raise NotImplementedError
def prox(self, x, tau): raise NotImplementedError
@@ -136,6 +136,8 @@ class Norm2sq(Function):
'''
def __init__(self,A,b,c=1.0,memopt=False):
+ super(Norm2sq, self).__init__()
+
self.A = A # Should be an operator, default identity
self.b = b # Default zero DataSet?
self.c = c # Default 1.
@@ -146,11 +148,13 @@ class Norm2sq(Function):
self.adjoint_placehold = A.allocate_adjoint()
- # Compute the Lipschitz parameter from the operator.
- # Initialise to None instead and only call when needed.
- self.L = 2.0*self.c*(self.A.get_max_sing_val()**2)
- super(Norm2sq, self).__init__()
-
+ # Compute the Lipschitz parameter from the operator if possible
+ # Leave it initialised to None otherwise
+ try:
+ self.L = 2.0*self.c*(self.A.get_max_sing_val()**2)
+ except AttributeError as ae:
+ pass
+
def grad(self,x):
#return 2*self.c*self.A.adjoint( self.A.direct(x) - self.b )
return (2.0*self.c)*self.A.adjoint( self.A.direct(x) - self.b )
diff --git a/Wrappers/Python/conda-recipe/conda_build_config.yaml b/Wrappers/Python/conda-recipe/conda_build_config.yaml
index 0706479..96a211f 100644
--- a/Wrappers/Python/conda-recipe/conda_build_config.yaml
+++ b/Wrappers/Python/conda-recipe/conda_build_config.yaml
@@ -3,6 +3,6 @@ python:
- 3.5
- 3.6
numpy:
- # doesn't build with, cvxp requires >1.14
+ # TODO investigage, as it doesn't currently build with cvxp, requires >1.14
#- 1.12
- 1.15