Skip to content

Commit d04409d

Browse files
committed
fix: use cg instead of lsqr in AffineSet
1 parent b19399c commit d04409d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pyproximal/projection/AffineSet.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from scipy.sparse.linalg import lsqr as sp_lsqr
2-
from pylops.optimization.basic import lsqr
2+
from scipy.sparse.linalg import cg as sp_cg
3+
from pylops.optimization.basic import cg, lsqr
34
from pylops.utils.backend import get_array_module, get_module_name
45

56

@@ -41,8 +42,8 @@ def __init__(self, Op, b, niter):
4142

4243
def __call__(self, x):
4344
if get_module_name(get_array_module(x)) == 'numpy':
44-
inv = sp_lsqr(self.Op * self.Op.H, self.Op * x - self.b, iter_lim=self.niter)[0]
45+
inv = sp_cg(self.Op * self.Op.H, self.Op * x - self.b, maxiter=self.niter)[0]
4546
else:
46-
inv = lsqr(self.Op * self.Op.H, self.Op * x - self.b, niter=self.niter)[0]
47+
inv = cg(self.Op * self.Op.H, self.Op * x - self.b, niter=self.niter)[0]
4748
y = x - self.Op.H * inv.ravel() # currently ravel is added to ensure that the output is always a vector
4849
return y

0 commit comments

Comments
 (0)