[Numpy-discussion] RE: default axis for numarray

Scott Ransom ransom at physics.mcgill.ca
Wed Jun 12 07:27:02 EDT 2002

On Wed, Jun 12, 2002 at 10:32:12AM +0200, Konrad Hinsen wrote:
> Scott Ransom <ransom at physics.mcgill.ca> writes:
> > On June 11, 2002 04:56 pm, you wrote:
> > > One can make a case for allowing == and != for complex arrays, but >
> > > just doesn't make sense and should not be allowed.
> > 
> > It depends if you think of complex numbers in phasor form or not.  In phasor 
> > form, the amplitude of the complex number is certainly something that you 
> > could compare with > or < -- and in my opinion, that seems like a reasonable 
> Sure, but that doesn't give a full order relation for complex numbers.
> Two different numbers with equal magnitude would be neither equal nor
> would one be larger than the other.

The comparison operators could be defined to operate on the
magnitudes only.  In this case you would get the kind of ugly
result that two complex numbers with the same magnitude but
different phases would be equal.

Complex comparisons of this type could be quite useful to those
(like me) who are do lots of Fourier domain signal processing.

> I agree with Paul that complex comparison should not be allowed. On the
> other hand, Perry's argument about sorting makes sense as well. Is there
> anything that prevents us from permitting arraysort() on complex arrays
> but not the comparison operators?

How do you sort an array of complex numbers if you can't compare them?


Scott M. Ransom              Address:  McGill Univ. Physics Dept.
Phone:  (514) 398-6492                 3600 University St., Rm 338
email:  ransom at physics.mcgill.ca       Montreal, QC  Canada H3A 2T8 
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989

More information about the NumPy-Discussion mailing list