[SciPy-user] linalg.eig

Pearu Peterson pearu at cens.ioc.ee
Thu Oct 31 11:32:25 EST 2002


On Thu, 31 Oct 2002, Nils Wagner wrote:

> How do I sort the eigenvalues and corresponding eigenvectors of
> 
> w,vr = linalg.eig(A,B)
> 
> in increasing order. It is assumed that all eigenvalues are real.

Try:

l = zip(w.astype('d'),vr)
l.sort(lambda x,y:cmp(x[0],y[0]))

As a result, the list l contains sorted 
pairs (<eigenvalue>,<eigenvector>).

Pearu





More information about the SciPy-User mailing list