

def test_simple_exact(self):
    for dtype in REAL_DTYPES:
        a = np.array([[1, 20], [(- 30), 4]], dtype=dtype)
        for lapack_driver in TestLstsq.lapack_drivers:
            for overwrite in (True, False):
                for bt in (((1, 0), (0, 1)), (1, 0), ((2, 1), ((- 30), 4))):
                    a1 = a1.copy()
                    b = np.array(bt, dtype=dtype)
                    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(dot(a, x), b, atol=(25 * np.finfo(a1.dtype).eps), rtol=(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_exact/VarMisuse@111/130 `a`->`a1`