

def test_check_finite(self):
    for dtype in REAL_DTYPES:
        a = np.array(((1, 20), ((- 30), 4)), dtype=dtype)
        for bt in (((1, 0), (0, 1)), (1, 0), ((2, 1), ((- 30), 4))):
            for lapack_driver in TestLstsq.lapack_drivers:
                for overwrite in (True, False):
                    for check_finite in (True, False):
                        b = np.array(bt, dtype=dtype)
                        a1 = a.copy()
                        b1 = b.copy()
                        try:
                            out = lstsq(a1, b1, lapack_driver=lapack_driver, check_finite=check_finite, overwrite_a=overwrite, overwrite_b=overwrite)
                        except LstsqLapackError:
                            if (lapack_driver is None):
                                mesg = 'LstsqLapackError raised with lapack_driver being None.'
                                raise AssertionError(mesg)
                            else:
                                continue
                        x = out[0]
                        r = out[2]
                        assert_((r == 2), ('expected efficient rank 2, got %s' % r))
                        assert_allclose(dot(a, x), b, rtol=(25 * np.finfo(a.dtype).eps), atol=(25 * np.finfo(a.dtype).eps), err_msg=('driver: %s' % lapack_driver))

dataset/ETHPy150Open scipy/scipy/scipy/linalg/tests/test_basic.py TestLstsq.test_check_finite/original