ee823bd38d1614733ae84ae464d5fdc61be4df9b,scipy/linalg/tests/test_basic.py,TestLstsq,test_simple_overdet_complex,#TestLstsq#,748

Before Change


        assert_almost_equal((abs(dot(a,x) - b)**2).sum(axis=0), res)

    def test_simple_overdet_complex(self):
        a = [[1+2j,2],[4,5],[3,4]]
        b = [1,2+4j,3]
        x,res,r,s = lstsq(a,b)
        assert_array_almost_equal(x,direct_lstsq(a,b,cmplx=1))
        assert_almost_equal(res, (abs(dot(a,x) - b)**2).sum(axis=0))

    def test_simple_underdet(self):

After Change



    def test_simple_overdet_complex(self):

        for dtype in COMPLEX_DTYPES:
            a = np.array(((1+2j,2),(4,5),(3,4)), dtype=dtype)
            b = np.array((1,2+4j,3), dtype=dtype)
            for lapack_driver in TestLstsq.lapack_drivers:
                for overwrite in (True,False):
                    // 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]
                    residuals = out[1]
                    r = out[2]
                    assert_(r == 2, "unexpected efficient rank")
                    assert_allclose(abs((dot(a,x) - b)**2).sum(axis=0),
                                        residuals,
                                        rtol=25*np.finfo(a1.dtype).eps,
                                        atol=25*np.finfo(a1.dtype).eps,
                                        err_msg="driver: %s" % lapack_driver)
                    assert_allclose(x,(-0.4831460674157303+0.258426966292135j,
                                        0.921348314606741+0.292134831460674j),
                                        rtol=25*np.finfo(a1.dtype).eps,
                                        atol=25*np.finfo(a1.dtype).eps,
                                        err_msg="driver: %s" % lapack_driver)

    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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 32

Instances


Project Name: scipy/scipy
Commit Name: ee823bd38d1614733ae84ae464d5fdc61be4df9b
Time: 2015-11-12
Author: alex.grigorievskiy@gmail.com
File Name: scipy/linalg/tests/test_basic.py
Class Name: TestLstsq
Method Name: test_simple_overdet_complex


Project Name: scipy/scipy
Commit Name: ee823bd38d1614733ae84ae464d5fdc61be4df9b
Time: 2015-11-12
Author: alex.grigorievskiy@gmail.com
File Name: scipy/linalg/tests/test_basic.py
Class Name: TestLstsq
Method Name: test_simple_underdet


Project Name: scipy/scipy
Commit Name: ee823bd38d1614733ae84ae464d5fdc61be4df9b
Time: 2015-11-12
Author: alex.grigorievskiy@gmail.com
File Name: scipy/linalg/tests/test_basic.py
Class Name: TestLstsq
Method Name: test_simple_overdet


Project Name: scipy/scipy
Commit Name: ee823bd38d1614733ae84ae464d5fdc61be4df9b
Time: 2015-11-12
Author: alex.grigorievskiy@gmail.com
File Name: scipy/linalg/tests/test_basic.py
Class Name: TestLstsq
Method Name: test_simple_overdet_complex