From ec8258917a286c7c9f3964a44626f2e83ae9cd8c Mon Sep 17 00:00:00 2001 From: mrava87 Date: Tue, 2 Jul 2024 14:10:50 +0100 Subject: [PATCH] fix: change atol behaviour for cg --- pylops/optimization/cls_leastsquares.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pylops/optimization/cls_leastsquares.py b/pylops/optimization/cls_leastsquares.py index a9e20fec..44e6cec1 100644 --- a/pylops/optimization/cls_leastsquares.py +++ b/pylops/optimization/cls_leastsquares.py @@ -219,7 +219,7 @@ def run( and cupy `data`, respectively) .. note:: - When user does not supply ``atol``, it is set to "legacy". + When user supplies ``tol`` this is set to ``atol``. Returns ------- @@ -238,8 +238,9 @@ def run( if x is not None: self.y_normal = self.y_normal - self.Op_normal.matvec(x) if engine == "scipy" and self.ncp == np: - if "atol" not in kwargs_solver: - kwargs_solver["atol"] = "legacy" + if "tol" in kwargs_solver: + kwargs_solver["atol"] = kwargs_solver["tol"] + kwargs_solver.pop("tol") xinv, istop = sp_cg(self.Op_normal, self.y_normal, **kwargs_solver) elif engine == "pylops" or self.ncp != np: if show: