-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.sparse.linalg
Milestone
Description
Describe your issue.
This test case fails on riscv64:
FAILED sparse/linalg/_isolve/tests/test_iterative.py::test_maxiter_worsening[lgmres] - AssertionError
This error looks similar to #13022 and 4383318. These errors are skipped on aarch64 and ppc64le, what about riscv64?
full build log: https://bugs.gentoo.org/attachment.cgi?id=847590
Reproducing Code Example
No code example, just test case.
Error message
==================================================================================================== FAILURES =====================================================================================================_________________________________________________________________________________________ test_maxiter_worsening[lgmres] __________________________________________________________________________________________[gw1] linux -- Python 3.10.9 /var/tmp/portage/dev-python/scipy-1.10.0/work/scipy-1.10.0-python3_10/install/usr/bin/python3.10
solver = <function lgmres at 0x3fae312950>
@pytest.mark.parametrize("solver", [
pytest.param(gmres, marks=pytest.mark.xfail(platform.machine() == 'aarch64'
and sys.version_info[1] == 9,
reason="gh-13019")),
qmr,
pytest.param(lgmres, marks=pytest.mark.xfail(platform.machine() == 'ppc64le',
reason="fails on ppc64le")),
pytest.param(cgs, marks=pytest.mark.xfail),
pytest.param(bicg, marks=pytest.mark.xfail),
pytest.param(bicgstab, marks=pytest.mark.xfail),
pytest.param(gcrotmk, marks=pytest.mark.xfail),
pytest.param(tfqmr, marks=pytest.mark.xfail)])
def test_maxiter_worsening(solver):
# Check error does not grow (boundlessly) with increasing maxiter.
# This can occur due to the solvers hitting close to breakdown,
# which they should detect and halt as necessary.
# cf. gh-9100
# Singular matrix, rhs numerically not in range
A = np.array([[-0.1112795288033378, 0, 0, 0.16127952880333685],
[0, -0.13627952880333782+6.283185307179586j, 0, 0],
[0, 0, -0.13627952880333782-6.283185307179586j, 0],
[0.1112795288033368, 0j, 0j, -0.16127952880333785]])
v = np.ones(4)
best_error = np.inf
tol = 7 if platform.machine() == 'aarch64' else 5
for maxiter in range(1, 20):
x, info = solver(A, v, maxiter=maxiter, tol=1e-8, atol=0)
if info == 0:
assert_(np.linalg.norm(A.dot(x) - v) <= 1e-8*np.linalg.norm(v))
error = np.linalg.norm(A.dot(x) - v)
best_error = min(best_error, error)
# Check with slack
> assert_(error <= tol*best_error)
E AssertionError
A = array([[-0.11127953+0.j , 0. +0.j ,
0. +0.j , 0.16127953+0.j ],
[ 0. +0.j , -0.13627953+6.28318531j,
0. +0.j , 0. +0.j ],
[ 0. +0.j , 0. +0.j ,
-0.13627953-6.28318531j, 0. +0.j ],
[ 0.11127953+0.j , 0. +0.j ,
0. +0.j , -0.16127953+0.j ]])
best_error = 1.414213562373095
error = 67.94531422934396
info = 8
maxiter = 8
solver = <function lgmres at 0x3fae312950>
tol = 5
v = array([1., 1., 1., 1.])
x = array([-1.17813344e+15+0.j , -6.61429022e+00-3.99819143j,
-6.61429022e+00+3.99819143j, -8.12887631e+14+0.j ])
../work/scipy-1.10.0-python3_10/install/usr/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/tests/test_iterative.py:487: AssertionError
SciPy/NumPy/Python version information
1.10.0 1.23.5 sys.version_info(major=3, minor=10, micro=9, releaselevel='final', serial=0)
Metadata
Metadata
Assignees
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.sparse.linalg