diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 88324dc..0ef00e2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,7 +41,8 @@ jobs: if: ${{ matrix.python-version == '3.12' }} run: | python -m pip install --upgrade pip - pip install git+https://github.com/litebird/litebird_sim.git@b7144f8 + pip install git+https://github.com/litebird/litebird_sim.git + pip install deprecated - name: Install BrahMap run: | diff --git a/brahmap/math/linalg.py b/brahmap/math/linalg.py index a6ab3e9..a4f2c5a 100644 --- a/brahmap/math/linalg.py +++ b/brahmap/math/linalg.py @@ -69,13 +69,23 @@ def cg( _type_ _description_ """ - A, M, x, b, postprocess = scipy.sparse.linalg._isolve.utils.make_system( + temp_tuple = scipy.sparse.linalg._isolve.utils.make_system( A, M, x0, b, ) + # Starting from SciPy 1.16.0, `make_system` returns 4 objects instead of 5. + # Even in earlier versions, only the first 4 objects were needed for our + # use. The following unpacking ensures compatibility across all versions. + # This logic can be simplified once support for versions below 1.16.0 is + # dropped. + A = temp_tuple[0] + M = temp_tuple[1] + x = temp_tuple[2] + b = temp_tuple[3] + if parallel: norm_function: Callable = parallel_norm else: @@ -91,7 +101,7 @@ def cg( ) if b_norm == 0: - return postprocess(b), 0 + return b, 0 dotprod = np.vdot if np.iscomplexobj(x) else np.dot @@ -105,7 +115,7 @@ def cg( for iteration in range(maxiter): if norm_residual < atol: - return postprocess(x), 0 + return x, 0 z = M * r rho_cur = dotprod(r, z) @@ -129,4 +139,4 @@ def cg( callback(x, r, norm_residual) else: - return postprocess(x), maxiter + return x, maxiter diff --git a/tests/test_noise_ops_toeplitz.py b/tests/test_noise_ops_toeplitz.py index a69c0ea..a08cc88 100644 --- a/tests/test_noise_ops_toeplitz.py +++ b/tests/test_noise_ops_toeplitz.py @@ -142,8 +142,8 @@ def test_Strang_precond(self, precond_type): class TestNoiseOps_Toeplitz_F32(NoiseOps_Toeplitz): dtype = np.float32 - rtol = 1.0e-4 - atol = 1.0e-5 + rtol = 1.0e-3 + atol = 1.0e-4 class TestNoiseOps_Toeplitz_F64(NoiseOps_Toeplitz):