Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TestCond.test_nan test failure for latest OpenBLAS #18914

Description

@rgommers

This is on a macOS system, but @mattip ran into it yesterday as well during a demo, and that was on Linux I believe. I cannot reproduce it on my macOS or Linux setups, nor on Gitpod. All those use openblas from conda-forge, the problem may be coming from another BLAS implementation or be hardware-specific.

=================================== FAILURES ===================================
______________________________ TestCond.test_nan _______________________________

self = <numpy.linalg.tests.test_linalg.TestCond object at 0x13d00e670>

    def test_nan(self):
        # nans should be passed through, not converted to infs
        ps = [None, 1, -1, 2, -2, 'fro']
        p_pos = [None, 1, 2, 'fro']
    
        A = np.ones((2, 2))
        A[0,1] = np.nan
        for p in ps:
>           c = linalg.cond(A, p)

A          = array([[ 1., nan],
       [ 1.,  1.]])
p          = None
p_pos      = [None, 1, 2, 'fro']
ps         = [None, 1, -1, 2, -2, 'fro']
self       = <numpy.linalg.tests.test_linalg.TestCond object at 0x13d00e670>

numpy/linalg/tests/test_linalg.py:777: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<__array_function__ internals>:5: in cond
    ???
        args       = (array([[ 1., nan],
       [ 1.,  1.]]), None)
        kwargs     = {}
        relevant_args = (array([[ 1., nan],
       [ 1.,  1.]]),)
numpy/linalg/linalg.py:1765: in cond
    s = svd(x, compute_uv=False)
        p          = None
        x          = array([[ 1., nan],
       [ 1.,  1.]])
<__array_function__ internals>:5: in svd
    ???
        args       = (array([[ 1., nan],
       [ 1.,  1.]]),)
        kwargs     = {'compute_uv': False}
        relevant_args = (array([[ 1., nan],
       [ 1.,  1.]]),)
numpy/linalg/linalg.py:1672: in svd
    s = gufunc(a, signature=signature, extobj=extobj)
        _nx        = <module 'numpy' from '/Users/username/Documents/GitHub/numpy/build/testenv/lib/python3.9/site-packages/numpy/__init__.py'>
        a          = array([[ 1., nan],
       [ 1.,  1.]])
        compute_uv = False
        extobj     = [8192, 1536, <function _raise_linalgerror_svd_nonconvergence at 0x117e80670>]
        full_matrices = True
        gufunc     = <ufunc 'svd_n'>
        hermitian  = False
        m          = 2
        n          = 2
        result_t   = <class 'numpy.float64'>
        signature  = 'd->d'
        t          = <class 'numpy.float64'>
        wrap       = <built-in method __array_prepare__ of numpy.ndarray object at 0x13c341510>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_svd_nonconvergence(err, flag):
>       raise LinAlgError("SVD did not converge")
E       numpy.linalg.LinAlgError: SVD did not converge

err        = 'invalid value'
flag       = 8

numpy/linalg/linalg.py:97: LinAlgError
=========================== short test summary info ============================
FAILED numpy/linalg/tests/test_linalg.py::TestCond::test_nan - numpy.linalg.L...
= 1 failed, 14429 passed, 611 skipped, 1237 deselected, 18 xfailed, 3 xpassed in 363.18s (0:06:03) =

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions