def test_random_complex_exact(self):
        for dtype in COMPLEX_DTYPES:
            for n in (20, 200):
                for lapack_driver in TestLstsq.lapack_drivers:
                    for overwrite in (True, False):
                        a = np.asarray(random([n,n]) + 1j*random([n,n]),
                                       dtype=dtype)
                        for i in range(n):
                            a[i,i] = 20 * (0.1 + a[i,i])
                        for i in range(2):
                            b = np.asarray(random([n,3]), dtype=dtype)
                            # Store values in case they are overwritten later
                            a1 = a.copy()
                            b1 = b.copy()
                            out = lstsq(a1, b1, lapack_driver=lapack_driver,
                                        overwrite_a=overwrite,
                                        overwrite_b=overwrite)
                            x = out[0]
                            r = out[2]
                            assert_(r == n, 'expected efficient rank %s, got '
                                             '%s' % (n, r))
                            if dtype is np.complex64:
                                assert_allclose(dot(a, x), b,
                                          rtol=400 * np.finfo(a1.dtype).eps,
                                          atol=400 * np.finfo(a1.dtype).eps,
                                          err_msg="driver: %s" % lapack_driver)
                            else:
                                assert_allclose(dot(a, x), b,
                                          rtol=1000 * np.finfo(a1.dtype).eps,
                                          atol=1000 * np.finfo(a1.dtype).eps,
                                          err_msg="driver: %s" % lapack_driver)
dataset/ETHPy150Open scipy/scipy/scipy/linalg/tests/test_basic.py/TestLstsq.test_random_complex_exact/original