

def test_simple_underdet(self):
    for dtype in REAL_DTYPES:
        a = np.array([[1, 2, 3], [4, 5, 6]], dtype=dtype)
        b = np.array([1, 2], dtype=dtype)
        for lapack_driver in TestLstsq.lapack_drivers:
            for overwrite in (True, False):
                a1 = a.copy()
                b1 = b.copy()
                try:
                    out = lstsq(a1, b1, lapack_driver=lapack_driver, 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(x, ((- 0.055555555555555), 0.111111111111111, 0.277777777777777), rtol=(25 * np.finfo(a1.dtype).eps), atol=(25 * np.finfo(a1.dtype).eps), err_msg=('driver: %s' % lapack_driver))

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