From 27f510d392c1e27f84557e5ab9f43066edf1cebd Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 16 Jun 2024 23:27:44 +0300 Subject: [PATCH] minor: revert test_solver --- tests/test_solver.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/test_solver.py b/tests/test_solver.py index e90f53f..716d2ac 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -90,7 +90,6 @@ ) def test_cg(par): """CG with MPIBlockDiag""" - np.random.seed(42) A = np.ones((par["ny"], par["nx"])) + par[ "imag"] * np.ones((par["ny"], par["nx"])) Aop = MatrixMult(np.conj(A.T) @ A, dtype=par['dtype']) @@ -127,7 +126,7 @@ def test_cg(par): x0 = None y1 = BDiag * x_global xinv1 = pylops.cg(BDiag, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0] - assert_allclose(xinv_array, xinv1, rtol=1e-12) + assert_allclose(xinv_array, xinv1, rtol=1e-14) @pytest.mark.mpi(min_size=2) @@ -136,7 +135,6 @@ def test_cg(par): ) def test_cgls(par): """CGLS with MPIBlockDiag""" - np.random.seed(42) A = np.ones((par["ny"], par["nx"])) + par[ "imag"] * np.ones((par["ny"], par["nx"])) Aop = MatrixMult(np.conj(A.T) @ A + 1e-5 * np.eye(par["nx"], dtype=par['dtype']), @@ -175,7 +173,7 @@ def test_cgls(par): x0 = None y1 = BDiag * x_global xinv1 = pylops.cgls(BDiag, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0] - assert_allclose(xinv_array, xinv1, rtol=1e-12) + assert_allclose(xinv_array, xinv1, rtol=1e-14) @pytest.mark.mpi(min_size=2) @@ -184,7 +182,6 @@ def test_cgls(par): ) def test_cgls_broadcastdata(par): """CGLS with broadcasted data vector""" - np.random.seed(42) A = (rank + 1) * np.ones((par["ny"], par["nx"])) + (rank + 2) * par[ "imag" ] * np.ones((par["ny"], par["nx"])) @@ -222,7 +219,7 @@ def test_cgls_broadcastdata(par): x0 = None y1 = Hstack @ x_global xinv1 = pylops.cgls(Hstack, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0] - assert_allclose(xinv_array, xinv1, rtol=1e-12) + assert_allclose(xinv_array, xinv1, rtol=1e-14) @pytest.mark.mpi(min_size=2) @@ -231,7 +228,6 @@ def test_cgls_broadcastdata(par): ) def test_cgls_broadcastmodel(par): """CGLS with broadcasted model vector""" - np.random.seed(42) A = np.ones((par["ny"], par["nx"])) + par[ "imag"] * np.ones((par["ny"], par["nx"])) Aop = MatrixMult(np.conj(A.T) @ A + 1e-5 * np.eye(par["nx"], dtype=par['dtype']), @@ -272,7 +268,7 @@ def test_cgls_broadcastmodel(par): x0 = None y1 = Vstack @ x_global xinv1 = pylops.cgls(Vstack, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0] - assert_allclose(xinv_array, xinv1, rtol=1e-12) + assert_allclose(xinv_array, xinv1, rtol=1e-14) @pytest.mark.mpi(min_size=2) @@ -281,7 +277,6 @@ def test_cgls_broadcastmodel(par): ) def test_cg_stacked(par): """CG with MPIStackedBlockDiag""" - np.random.seed(42) A = np.ones((par["ny"], par["nx"])) + par[ "imag"] * np.ones((par["ny"], par["nx"])) Aop = MatrixMult(np.conj(A.T) @ A + 1e-5 * np.eye(par["nx"], dtype=par['dtype']), @@ -336,7 +331,7 @@ def test_cg_stacked(par): x0 = None y1 = StackedBDiag * x_global xinv1 = pylops.cg(StackedBDiag, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0] - assert_allclose(xinv_array, xinv1, rtol=1e-12) + assert_allclose(xinv_array, xinv1, rtol=1e-14) @pytest.mark.mpi(min_size=2) @@ -345,7 +340,6 @@ def test_cg_stacked(par): ) def test_cgls_stacked(par): """CGLS with MPIStackedBlockDiag""" - np.random.seed(42) A = np.ones((par["ny"], par["nx"])) + par[ "imag"] * np.ones((par["ny"], par["nx"])) Aop = MatrixMult(np.conj(A.T) @ A + 1e-5 * np.eye(par["nx"], dtype=par['dtype']), @@ -402,4 +396,4 @@ def test_cgls_stacked(par): x0 = None y1 = StackedBDiag * x_global xinv1 = pylops.cgls(StackedBDiag, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0] - assert_allclose(xinv_array, xinv1, rtol=1e-12) + assert_allclose(xinv_array, xinv1, rtol=1e-14)