question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scipy.linalg.tests.test_interpolative::TestInterpolativeDecomposition::test_id fails on 32-bit intel

See original GitHub issue

Reproducing code example:

python3.6 runtests.py -v -t scipy.linalg.tests.test_interpolative::TestInterpolativeDecomposition::test_id

Error message:

Building, see build.log...
Build OK (0:00:02.503862 elapsed)
============================= test session starts ==============================
platform linux -- Python 3.6.6+, pytest-3.6.4, py-1.5.4, pluggy-0.6.0 -- /usr/bin/python3.6
cachedir: ../../../../../.pytest_cache
rootdir: /root/scipy, inifile: pytest.ini
collecting ... collected 1 item

scipy/linalg/tests/test_interpolative.py::TestInterpolativeDecomposition::test_id FAILED [100%]

=================================== FAILURES ===================================
____________________ TestInterpolativeDecomposition.test_id ____________________

self = <scipy.linalg.tests.test_interpolative.TestInterpolativeDecomposition object at 0xf4ee6cac>

    def test_id(self):
        for dtype in [np.float64, np.complex128]:
>           self.check_id(dtype)

dtype      = <class 'numpy.complex128'>
self       = <scipy.linalg.tests.test_interpolative.TestInterpolativeDecomposition object at 0xf4ee6cac>

scipy/linalg/tests/test_interpolative.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <scipy.linalg.tests.test_interpolative.TestInterpolativeDecomposition object at 0xf4ee6cac>
dtype = <class 'numpy.complex128'>

    def check_id(self, dtype):
        # Test ID routines on a Hilbert matrix.
    
        # set parameters
        n = 300
        eps = 1e-12
    
        # construct Hilbert matrix
        A = hilbert(n).astype(dtype)
        if np.issubdtype(dtype, np.complexfloating):
            A = A * (1 + 1j)
        L = aslinearoperator(A)
    
        # find rank
        S = np.linalg.svd(A, compute_uv=False)
        try:
            rank = np.nonzero(S < eps)[0][0]
        except IndexError:
            rank = n
    
        # print input summary
        _debug_print("Hilbert matrix dimension:        %8i" % n)
        _debug_print("Working precision:               %8.2e" % eps)
        _debug_print("Rank to working precision:       %8i" % rank)
    
        # set print format
        fmt = "%8.2e (s) / %5s"
    
        # test real ID routines
        _debug_print("-----------------------------------------")
        _debug_print("Real ID routines")
        _debug_print("-----------------------------------------")
    
        # fixed precision
        _debug_print("Calling iddp_id / idzp_id  ...",)
        t0 = time.time()
        k, idx, proj = pymatrixid.interp_decomp(A, eps, rand=False)
        t = time.time() - t0
        B = pymatrixid.reconstruct_matrix_from_id(A[:, idx[:k]], idx, proj)
        _debug_print(fmt % (t, np.allclose(A, B, eps)))
>       assert_(np.allclose(A, B, eps))
E       AssertionError

A          = array([[1.        +1.j        , 0.5       +0.5j       ,
        0.33333333+0.33333333j, ..., 0.0033557 +0.0033557j ,
 ...
        0.00331126+0.00331126j, ..., 0.00167504+0.00167504j,
        0.00167224+0.00167224j, 0.00166945+0.00166945j]])
B          = array([[1.        +1.00000000e+00j, 0.5       +5.00000000e-01j,
        0.33333333+3.33333333e-01j, ..., 0.00252299+3....126+3.31125828e-03j, ..., 0.00240064+4.01219469e-04j,
        0.00239738+3.93272780e-04j, 0.00239412+3.85406210e-04j]])
L          = <300x300 MatrixLinearOperator with dtype=complex128>
S          = array([3.28383209e+00, 1.46118973e+00, 4.85550807e-01, 1.40695788e-01,
       3.77404295e-02, 9.57267036e-03, 2.318987...3.61515144e-19, 3.44841007e-19, 2.67885523e-19,
       2.14393434e-19, 1.38418788e-19, 1.08774972e-19, 3.53735496e-20])
dtype      = <class 'numpy.complex128'>
eps        = 1e-12
fmt        = '%8.2e (s) / %5s'
idx        = array([  0,  76,   1, 134,   2,   5,   6,   7,   8,   9,  10,  11,  12,
        13,  14,  15,  16,  17,  18,  19,  20,..., 282, 283, 284, 285,
       286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
       299], dtype=int32)
k          = 5
n          = 300
proj       = array([[ 1.14253932e+00+8.14415919e-01j,  1.02685117e+00+7.27996082e-01j,
         9.31616510e-01+6.56616558e-01j, .......,
        -6.28869125e-03-4.88365418e-03j, -6.30277694e-03-4.85859879e-03j,
        -6.31662104e-03-4.83374460e-03j]])
rank       = 20
self       = <scipy.linalg.tests.test_interpolative.TestInterpolativeDecomposition object at 0xf4ee6cac>
t          = 0.0024597644805908203
t0         = 1536620034.2090552

scipy/linalg/tests/test_interpolative.py:89: AssertionError
=========================== 1 failed in 0.55 seconds ===========================

Scipy/Numpy/Python version information:

1.2.0.dev0+641bc92 1.14.5 sys.version_info(major=3, minor=6, micro=6, releaselevel='final', serial=0)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yangflcommented, Oct 29, 2018

I’ve found a ridiculous patch for this

--- a/scipy/linalg/src/id_dist/src/idz_house.f
+++ b/scipy/linalg/src/id_dist/src/idz_house.f
@@ -217,6 +217,7 @@ c       identity_matrix - scal * vn * adjoint(vn).
 c
         do k = 2,n
           vn(k) = x(k)/v1
+          print*,"aaa"
         enddo ! k
 c
 c       scal = 2

(On Debian) with gfortran-7 test passed with this patch, with gfortran-8 test passed with no “aaa” output!

0reactions
rgommerscommented, Nov 13, 2021

Let me just copy the whole failure before it disappears:

____________________ TestInterpolativeDecomposition.test_id ____________________
/usr/lib/python3/dist-packages/scipy/linalg/tests/test_interpolative.py:49: in test_id
    self.check_id(dtype)
        dtype      = <class 'numpy.complex128'>
        self       = <scipy.linalg.tests.test_interpolative.TestInterpolativeDecomposition object at 0xf2488d30>
/usr/lib/python3/dist-packages/scipy/linalg/tests/test_interpolative.py:215: in check_id
    assert_(np.allclose(norm_2_est, s[0], 1e-6))
E   AssertionError
        A          = array([[1.        +1.j        , 0.5       +0.5j       ,
        0.33333333+0.33333333j, ..., 0.0033557 +0.0033557j ,
 ...
        0.00331126+0.00331126j, ..., 0.00167504+0.00167504j,
        0.00167224+0.00167224j, 0.00166945+0.00166945j]])
        B          = array([[1.2       +1.2j       , 0.5       +0.5j       ,
        0.33333333+0.33333333j, ..., 0.0033557 +0.0033557j ,
 ...
        0.00331126+0.00331126j, ..., 0.00167504+0.00167504j,
        0.00167224+0.00167224j, 0.00166945+0.00166945j]])
        L          = <300x300 MatrixLinearOperator with dtype=complex128>
        P          = array([[ 1.00000000e+00+0.j,  0.00000000e+00+0.j,  0.00000000e+00+0.j,
        ...,  2.25171457e-07+0.j,  1.16707641e-...000e+00+0.j,  0.00000000e+00+0.j,
        ..., -8.74287929e-02+0.j, -4.53134649e-02+0.j,
         0.00000000e+00+0.j]])
        S          = array([3.28383209e+00, 1.46118973e+00, 4.85550807e-01, 1.40695788e-01,
       3.77404295e-02, 9.57267036e-03, 2.318987...4.42545591e-08, 8.40712064e-09, 1.56054765e-09,
       2.83385586e-10, 5.02090098e-11, 8.58537076e-12, 1.33753369e-12])
        Sp         = array([3.28383209e+00, 1.46118973e+00, 4.85550807e-01, 1.40695788e-01,
       3.77404295e-02, 9.57267036e-03, 2.318987...4.42544312e-08, 8.40678158e-09, 1.56046078e-09,
       2.83279443e-10, 5.03338368e-11, 8.74599062e-12, 1.38441122e-12])
        U          = array([[-3.33862414e-01-3.38400763e-01j, -4.26655899e-01-4.32305387e-01j,
        -3.44023082e-01-3.48252969e-01j, .......,
         8.25595993e-02+8.06604877e-02j, -7.85803534e-02-7.35863157e-02j,
        -4.80050523e-02-5.23466069e-02j]])
        Up         = array([[-3.36139248e-01-3.36139248e-01j, -4.29489933e-01-4.29489933e-01j,
        -3.46144487e-01-3.46144487e-01j, .......,
         8.21560462e-02+8.21560462e-02j, -7.91111334e-02-7.91111334e-02j,
        -5.30722731e-02-5.30722731e-02j]])
        V          = array([[-4.75361852e-01-3.20909746e-03j, -6.07377351e-01-3.99479136e-03j,
        -4.89513090e-01-2.99098200e-03j, .......,
         1.14751335e-01-8.59612707e-04j, -1.17902955e-01+7.48730674e-03j,
        -1.09644464e-01+5.07030843e-02j]])
        Vp         = array([[-4.75372684e-01-5.32605416e-17j, -6.07390488e-01-1.46845415e-16j,
        -4.89522228e-01-8.01620014e-17j, .......,
         1.16663313e-01+3.08722316e-16j, -1.19649216e-01+9.42101388e-16j,
        -1.15567263e-01+4.27903515e-15j]])
        dtype      = <class 'numpy.complex128'>
        eps        = 1e-12
        fmt        = '%8.2e (s) / %5s'
        idx        = array([  0,   3,  28,   1, 168,  10,  72, 299,   2,  16,   6, 111,  44,
       243,   4,  21, 204,   8,  57,   5,  20,..., 282, 283, 284, 285,
       286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
         7], dtype=int32)
        k          = 20
        n          = 300
        norm_2_est = 0.8876773151268761
        proj       = array([[-1.73301674e-07+0.j,  3.26087501e-07+0.j,  1.70123639e-07+0.j,
        ...,  2.25171457e-07+0.j,  1.16707641e-...886e-01+0.j, -8.87428264e-02+0.j,
        ..., -8.74287929e-02+0.j, -4.53134649e-02+0.j,
        -3.09021875e-01+0.j]])
        rank       = 20
        s          = array([0.36239275, 0.        , 0.        , 0.        , 0.        ,
       0.        , 0.        , 0.        , 0.      ...  , 0.        , 0.        , 0.        , 0.        ,
       0.        , 0.        , 0.        , 0.        , 0.        ])
        self       = <scipy.linalg.tests.test_interpolative.TestInterpolativeDecomposition object at 0xf2488d30>
        t          = 0.0386967658996582
        t0         = 1636636277.0996747
Read more comments on GitHub >

github_iconTop Results From Across the Web

linalg tests failing in runtests.py #11601 - scipy/scipy - GitHub
My issue is about working on a code change in scipy.special tests passed in special when performing full test suite before opening a...
Read more >
SciPy 1.9.0 Release Notes — SciPy v1.9.3 Manual
SciPy 1.9.0 is the culmination of 6 months of hard work. It contains many new features, numerous bug-fixes, improved test coverage and better...
Read more >
SciPy 1.6.0 Release Notes — SciPy v1.9.3 Manual
The new function scipy.linalg.matmul_toeplitz uses the FFT to compute the ... #12899: TST: make a couple of tests expected to fail on 32-bit...
Read more >
SciPy 1.5.0 Release Notes — SciPy v1.9.3 Manual
SciPy 1.5.0 is the culmination of 6 months of hard work. It contains many new features, numerous bug-fixes, improved test coverage and better...
Read more >
SciPy 1.7.0 Release Notes — SciPy v1.9.3 Manual
The new function scipy.stats.page_trend_test performs Page's test for ordered ... #14170: TST: signal submodule test_filtfilt_gust failing on 32-bit amd64…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found