octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add min/max tests. (4/4)


From: John W. Eaton
Subject: Re: [PATCH] Add min/max tests. (4/4)
Date: Tue, 5 Sep 2000 22:54:43 -0500 (CDT)

On  4-Sep-2000, Edward Jason Riedy <address@hidden> wrote:

| And "John W. Eaton" writes:
|  - I think that
| [...]
|  - is much less surprising than
| [...]
|  - since -2 is smaller than 1 [...]
| 
| Not in magnitude.  I suppose that's the key.  
| 
| I just realized the behavior I want to avoid still occurs.  Imagine
| a nice long calculation intended for complex matrices and magnitude
| comparisons written with min / max.  Now imagine that a column just
| happens to become all real...  I wouldn't want to try to debug that
| problem.
| 
| Unfortunately, it still happens when a matrix becomes all real ``by 
| accident,'' so there does need to be a way to specify magnitude
| comparisons to min / max.

How about

  min (abs (x), abs (y))

?

If I recall correctly, it doesn't really make sense to ask whether one
complex number is `less than' another.  That Matlab overloads the
relational operators to mean X op Y == abs(X) op abs(Y) is, I believe,
just a convention.  Someone (presumably Cleve Moler) thought it would
be a convenient shorthand.  I suppose it is in some cases, but it also
introduces some ambiguity and surprising results (something of a
running theme in the design of Matlab, if you ask me).

If it were up to me (or if I could do it over again) I'd say that min,
max, <, <=, >, >= have no meaning for complex numbers in Octave, and
that if you want to compare magnitudes, you have to state that
explicitly.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]