[Numpy-discussion] Question about numpy.max(<complex matrix>)
David Goldsmith
David.L.Goldsmith@noaa....
Fri Sep 21 20:48:12 CDT 2007
Apparently so.
Not to be snide, but I found this thread very "entertaining," as,
precisely because there is no single, well-defined (partial) ordering of
C, I regard it as poor coding practice to rely on whatever partial
ordering the language you're using may (IMO unwisely) provide: if you
want max(abs(complex_array)), then you should write that so that future
people reading your code have no doubt that that's what you intended;
likewise, even if numpy provides it as a default, IMO, if you want
max(real(complex_array)), then you should write that, and if you want
max(imag(complex_array[where(complex_array ==
max(real(complex_array))])) (sorry if my numpy is bad) then you should
write that (yes, I know it's not very readable, but it accurately
portrays your intent and to me, that's paramount.) JMO,
DG
Stuart Brorson wrote:
>> No. It is a matter of sorting first on the real part, and then resolving
>> duplicates by sorting on the imaginary part. The magnitude is not used:
>>
> [snip]
>
> Oh, OK. So the ordering algorithm for complex numbers is:
>
> 1. First sort on real part.
> 2. Then sort on imag part.
>
> Right?
>
> Stuart
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
--
ERD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/emergencyresponse/>
More information about the Numpy-discussion
mailing list