Esempio n. 1
0
def test_scipy_solvers(rng):
    A, b = get_system(1000, 100, 2, rng=rng)
    sigma = 0.1 * A.max()

    x0, _ = cholesky(A, b, sigma)
    x1, _ = conjgrad_scipy(A, b, sigma)
    x2, _ = lsmr_scipy(A, b, sigma)
    assert np.allclose(x0, x1, atol=2e-5, rtol=1e-3)
    assert np.allclose(x0, x2, atol=2e-5, rtol=1e-3)
Esempio n. 2
0
def test_scipy_solvers():
    rng = np.random.RandomState(4829)
    A, b = get_system(1000, 100, 2, rng=rng)
    sigma = 0.1 * A.max()

    x0, _ = cholesky(A, b, sigma)
    x1, _ = conjgrad_scipy(A, b, sigma)
    x2, _ = lsmr_scipy(A, b, sigma)
    assert np.allclose(x0, x1, atol=2e-5, rtol=1e-3)
    assert np.allclose(x0, x2, atol=2e-5, rtol=1e-3)
Esempio n. 3
0
def test_scipy_solvers(rng):
    pytest.importorskip('scipy', minversion='0.11')  # version for lsmr

    A, b = get_system(1000, 100, 2, rng=rng)
    sigma = 0.1 * A.max()

    x0, _ = cholesky(A, b, sigma)
    x1, _ = conjgrad_scipy(A, b, sigma)
    x2, _ = lsmr_scipy(A, b, sigma)
    assert np.allclose(x0, x1, atol=2e-5, rtol=1e-3)
    assert np.allclose(x0, x2, atol=2e-5, rtol=1e-3)
Esempio n. 4
0
def test_scipy_solvers(rng):
    pytest.importorskip('scipy', minversion='0.11')  # version for lsmr

    A, b = get_system(1000, 100, 2, rng=rng)
    sigma = 0.1 * A.max()

    x0, _ = cholesky(A, b, sigma)
    x1, _ = conjgrad_scipy(A, b, sigma)
    x2, _ = lsmr_scipy(A, b, sigma)
    assert np.allclose(x0, x1, atol=2e-5, rtol=1e-3)
    assert np.allclose(x0, x2, atol=2e-5, rtol=1e-3)