[SciPy-dev] check_random_complex_overdet (scipy.linalg.tests.test_basic.test_lstsq)

Nils Wagner nwagner at iam.uni-stuttgart.de
Tue Jun 27 02:23:45 CDT 2006

Hi all,

Please correct me but you will need


instead of


in direct_lstsq(a,b) for c o m p l e x overdeternined systems.

Am I missing something ?


def check_random_overdet(self):
        n = 20
        m = 15
        a = random([n,m])
        for i in range(m): a[i,i] = 20*(.1+a[i,i])
        for i in range(4):
            b = random([n,3])
            x,res,r,s = lstsq(a,b)
            assert r==m,'unexpected efficient rank'
            #XXX: check definition of res

def direct_lstsq(a,b):
    a1 = numpy.dot(numpy.transpose(a),a)
    b1 = numpy.dot(numpy.transpose(a),b)
    return solve(a1,b1)


More information about the Scipy-dev mailing list