@@ -73,17 +73,16 @@ def _proxdual_moreau(self, x, tau, **kwargs):
7373    def  prox (self , x , tau , ** kwargs ):
7474        """Proximal operator applied to a vector 
7575
76-         The   proximal operator can always be computed given its dual 
76+         The proximal operator can always be computed given its dual 
7777        proximal operator using the Moreau decomposition as defined in 
78-         :func:`pyprox .moreau`. For this reason we can easily create a common 
78+         :func:`pyproximal .moreau`. For this reason we can easily create a common 
7979        method for all proximal operators that can be evaluated provided the 
8080        dual proximal is implemented. 
8181
8282        However, direct implementations are generally available. This can 
8383        be done by simply implementing ``prox`` for a specific proximal 
8484        operator, which will overwrite the general method. 
8585
86- 
8786        Parameters 
8887        ---------- 
8988        x : :obj:`np.ndarray` 
@@ -100,9 +99,9 @@ def proxdual(self, x, tau, **kwargs):
10099
101100        The dual of a proximal operator can always be computed given its 
102101        proximal operator using the Moreau decomposition as defined in 
103-         :func:`pyprox .moreau`. For this reason we can easily create a common 
102+         :func:`pyproximal .moreau`. For this reason we can easily create a common 
104103        method for all dual proximal operators that can be evaluated provided 
105-         he  proximal is implemented. 
104+         the  proximal is implemented. 
106105
107106        However, since the dual of a proximal operator of a function is 
108107        equivalent to the proximal operator of the conjugate function, smarter 
@@ -163,7 +162,7 @@ def affine_addition(self, v):
163162        if  isinstance (v , np .ndarray ):
164163            return  _SumOperator (self , v )
165164        else :
166-             return   NotImplemented 
165+             raise   NotImplementedError ( 'v must be of type numpy.ndarray' ) 
167166
168167    def  postcomposition (self , sigma ):
169168        r"""Postcomposition 
@@ -191,7 +190,7 @@ def postcomposition(self, sigma):
191190        if  isinstance (sigma , float ):
192191            return  _PostcompositionOperator (self , sigma )
193192        else :
194-             return   NotImplemented 
193+             raise   NotImplementedError ( 'sigma must be of type float' ) 
195194
196195    def  precomposition (self , a , b ):
197196        r"""Precomposition 
@@ -217,10 +216,12 @@ def precomposition(self, a, b):
217216            prox_{a^2 \tau f} (a \mathbf{x} + b) - b) 
218217
219218        """ 
220-         if  isinstance (a , float ) and  isinstance (b , float ):
219+         if  isinstance (a , float ) and  isinstance (b , ( float ,  np . ndarray ) ):
221220            return  _PrecompositionOperator (self , a , b )
222221        else :
223-             return  NotImplemented 
222+             raise  NotImplementedError ('a must be of type float and b ' 
223+                                       'must be of type float or ' 
224+                                       'numpy.ndarray' )
224225
225226    def  chain (self , g ):
226227        r"""Chain 
@@ -347,7 +348,7 @@ def __init__(self, f, a, b):
347348        #    raise ValueError('First input must be a ProxOperator') 
348349        if  not  isinstance (a , float ):
349350            raise  ValueError ('Second input must be a float' )
350-         if  not  isinstance (b , float ):
351+         if  not  isinstance (b , ( float ,  np . ndarray ) ):
351352            raise  ValueError ('Second input must be a float' )
352353        self .f , self .a , self .b  =  f , a , b 
353354        super ().__init__ (None , True  if  f .grad  else  False )
0 commit comments