Skip to content

Commit 0e8caf7

Browse files
authored
Merge pull request #157 from mrava87/patch-affine
fix: use cg instead of lsqr in AffineSet
2 parents b19399c + 3147167 commit 0e8caf7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
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

pyproximal/projection/Hankel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from scipy.linalg import hankel
33

44

5-
class HankelProj:
5+
class HankelProj():
66
r"""Hankel matrix projection.
77
88
Solves the least squares problem

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pytest
1010
pytest-runner
1111
setuptools_scm
1212
docutils<0.18
13-
Sphinx==4.2.0
13+
Sphinx
1414
sphinx-gallery
1515
pydata-sphinx-theme
1616
numpydoc

0 commit comments

Comments
 (0)