@@ -48,6 +48,11 @@ class L2(ProxOperator):
4848 avoids to do so unless the :math:`\tau` or :math:`\sigma` paramets
4949 have changed. Choose ``densesolver=None`` when using PyLops versions
5050 earlier than v1.18.1 or v2.0.0
51+ **kwargs_solver : :obj:`dict`, optional
52+ Dictionary containing extra arguments for
53+ :py:func:`scipy.sparse.linalg.lsqr` solver when using
54+ numpy data (or :py:func:`pylops.optimization.solver.lsqr` and
55+ when using cupy data)
5156
5257 Notes
5358 -----
@@ -89,7 +94,8 @@ class L2(ProxOperator):
8994
9095 """
9196 def __init__ (self , Op = None , b = None , q = None , sigma = 1. , alpha = 1. ,
92- qgrad = True , niter = 10 , x0 = None , warm = True , densesolver = None ):
97+ qgrad = True , niter = 10 , x0 = None , warm = True ,
98+ densesolver = None , kwargs_solver = None ):
9399 super ().__init__ (Op , True )
94100 self .b = b
95101 self .q = q
@@ -101,6 +107,7 @@ def __init__(self, Op=None, b=None, q=None, sigma=1., alpha=1.,
101107 self .warm = warm
102108 self .densesolver = densesolver
103109 self .count = 0
110+ self .kwargs_solver = {} if kwargs_solver is None else kwargs_solver
104111
105112 # when using factorize, store the first tau*sigma=0 so that the
106113 # first time it will be recomputed (as tau cannot be 0)
@@ -169,9 +176,11 @@ def prox(self, x, tau):
169176 Op1 = Identity (self .Op .shape [1 ], dtype = self .Op .dtype ) + \
170177 float (tau * self .sigma ) * (self .Op .H * self .Op )
171178 if get_module_name (get_array_module (x )) == 'numpy' :
172- x = sp_lsqr (Op1 , y , iter_lim = niter , x0 = self .x0 )[0 ]
179+ x = sp_lsqr (Op1 , y , iter_lim = niter , x0 = self .x0 ,
180+ ** self .kwargs_solver )[0 ]
173181 else :
174- x = lsqr (Op1 , y , niter = niter , x0 = self .x0 )[0 ].ravel ()
182+ x = lsqr (Op1 , y , niter = niter , x0 = self .x0 ,
183+ ** self .kwargs_solver )[0 ].ravel ()
175184 if self .warm :
176185 self .x0 = x
177186 elif self .b is not None :
0 commit comments