Stuart Brorson wrote: > Hi guys, > > As a NumPy newbie, I am still learning things about NumPy which I didn't > expect. Today I learned that for a matrix of complex numbers, > numpy.max() returns the element with the largest *real* part, not the > element with the largest *magnitude*.
There isn't a single, well-defined (partial) ordering of complex numbers. Both the lexicographical ordering (numpy) and the magnitude (Matlab) are useful, but the lexicographical ordering has the feature that (not (a < b)) and (not (b < a)) implies (a == b) This is not the case for using the magnitude. You can get the element of maximum magnitude like so: a.flat[absolute(a.flat).argmax()] -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
