April 28, 2007
8:47 p.m.
Travis Oliphant wrote:
One approach is to use argsort to create an index list of sorted eigenvalues and then sort the eig and eigvector arrays before zipping them together in a list of tuples.
eig, val = numpy.linalg.eig(a)
indx = eig.argsort() eig = eig.take(indx) val = val.take(indx, axis=1) master = zip(eig, val.T)
Thank you, that worked. http://www.ogre.nu/wp/?p=1978 I refined it slightly: val,vec = numpy.linalg.eig(adj) indx = val.argsort()[-4:-1] val = val.take(indx) vec = vec.take(indx, axis=1) master = zip(val, vec.T) -- Anton Sherwood, http://www.ogre.nu/ "How'd ya like to climb this high *without* no mountain?" --Porky Pine