[Numpy-discussion] nans and sort orders.

Charles R Harris charlesr.harris@gmail....
Tue Jul 28 12:41:50 CDT 2009


Hi All,

I've changed the sort routines so that they sort nans to the end. The sort
order is now

Real types: [R, nan]
Complex types: [R + Rj, R + nanj, nan + Rj, nan + nanj]

Where R stands for the usual extended range of reals, i.e. [-inf, finite,
+inf] and when two complex numbers have the same pattern of nans then they
are sorted on the non-nan part, if any.

So the sorts now work with nans but that implies some other fixups on which
I would like some feedback.

1) Search sorted -- Search sorted depends on the compare function of the
ndarray, I think that compare function should be changed to correspond to
the sort order.

2) Methods argmax/argmin/ -- should be compatible with max/min

3) max/min ufuncs -- Problematic, min would fail to propagate nans, should
probably stay the same.

4) fmax/fmin ufuncs -- Should stay with c definition

5) Logical comparison ufuncs -- I think these should remain compatible with
the c operators.

Note that there is a mix of implementations, max/min on void types use the
type comparison functions for instance. In other words, changing the type
comparisons could mean rewriting some of the other functions.

Thoughts?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090728/1e0e1ade/attachment-0002.html 


More information about the NumPy-Discussion mailing list