On 19/09/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:

> I'm not sure where the breakpoint is, but I was seeing failures for all
> three sort types with N as high as 10000. I suspect that they're all
> broken in the presence of  NaNs.  I further suspect you'd need some
> punishingly slow n**2 algorithm to be robust in the presence of NaNs.

Not at all. Just temporarily make NaNs compare greater than any other
floating-point value and use quicksort (say). You can even do this for
python lists without much trouble.

That's actually a viable suggestion for numpy's sorting, although it
would be kind of ugly to implement: do a quick any(isnan(A)), and if
not, use the fast stock sorting algorithms; if there is a NaN
somewhere in the array, use a version of the sort that has a tweaked
comparison function so the NaNs wind up at the end and are easy to
trim off.

But the current situation, silently returning arrays in which the
non-NaNs are unsorted, is really bad.

A. M. Archibald

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to