Anton Sherwood wrote: > Travis Oliphant wrote: > >> cmp(x,y) must return -1, 0, or 1 which doesn't work on arrays with more >> than 1 element because it is ambiguous. Thus you get this error. >> > > Ah. Since lists *can* be compared, I assumed arrays would inherit > that property. > > >> The operation is undefined. What do you actually want to do when you >> have equal-valued eigenvalues? >> > > Don't care. >
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) Will do what you want. -Travis _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion