x.min() depends on ordering

A. M. Archibald peridot.faceted at gmail.com
Sat Nov 11 17:58:36 CST 2006

On 11/11/06, Charles R Harris <charlesr.harris at gmail.com> wrote:

> I think the problem is that the max and min functions use the first value in
> the array as the starting point. That could be fixed by using the first
> non-nan and returning nan if there aren't any "real" numbers.  But it
> probably isn't worth the effort as the behavior becomes more complicated. A
> better rule of thumb is to note that comparisons involving nans are
> basically invalid because nans aren't comparable -- the comparison violates
> trichotomy. Don't really know what to do about that.

Well, we could get simple consistent behaviour by taking inf as the
initial value for min and -inf as the first value for max, then
reducing as normal. This would then, depending on how max and min are
implemented, either return NaN if any are present, or return the
smallest/largest non-NaN value (or inf/-inf if there are none)

A. M. Archibald

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

More information about the Numpy-discussion mailing list