diff options
Diffstat (limited to 'Wrappers/Python')
-rwxr-xr-x | Wrappers/Python/ccpi/optimisation/funcs.py | 16 | ||||
-rw-r--r-- | Wrappers/Python/conda-recipe/conda_build_config.yaml | 2 |
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 |