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: Edward Jason Riedy
Subject: Re: [PATCH] Add min/max tests. (4/4)
Date: Mon, 04 Sep 2000 09:32:35 -0700

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 hard would it be to allow either behavior (given an option to 
 - min/max)?

hmmm...  The simplest way seems to be

  * Change CMatrix::{row,column}_{min,max} back to using the odd (imho)
    comparisons: medium effort.  Making them keep _both_ magnitude and
    value tmps until they encounter a complex number would be the 
    easiest (and most cache-friendly).
  * Add {d,C}Matrix::{row,column}_{min_mag,max_mag} to do the magnitude
    comparisons in _both_ cases: mostly just typing.
  * Add another optional argument to src/DLD-FUNCTIONS/minmax.cc: not
    too bad, just ugly.

In all, not too bad, but the semester's started.  ;)  Might take me
another month to find the time, to be honest.  I have lots of house
work to keep me busy on the weekends for the next few weeks.

There are better ways, but they might take a hefty re-working of
the matrix member functions.  Might be more worth-while to look into
replacing them with the MTL than re-inventing it.

Jason



reply via email to

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