Re: [Numpy-discussion] argsort in descending order

2008-09-06 Thread Dan Lenski
On Fri, 05 Sep 2008 07:02:38 -0700, SimonPalmer wrote:

 another newb question I suspect, but is there a way to instruct argsort
 to sort in descending order or should I just sort and reverse?

Just sort and subtract to get the reverse order.  I can think of two 
reasonable ways to do it with no copying:

from numpy import *
a = rand(100)

# this does NOT make a copy of a, simply indexes it backward, and should 
# be very fast
reverseorder = argsort(a[::-1])

# this way doesn't make a copy either, and probably is a little slower
# since it has to do many subtractions
reverseorder = len(a)-1-argsort(a)

HTH,
Dan

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] does numpy have funcs like isanynan() or isallfinite()?

2008-09-06 Thread dmitrey
hi all,

does numpy have funcs like isanynan(array) or isallfinite(array)?

I very often use any(isnan(my_array)) or all(isfinite(my_array)), I 
guess having a single case triggered on would be enough here to omit 
further checks.

Regards, D.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] isnan and co: cleaning up

2008-09-06 Thread David Cournapeau
Charles R Harris wrote:


 This one http://en.wikipedia.org/wiki/Indent_style#K.26R_style

 int main(int argc, char *argv[])

 {
 ...
 while (x == y) {
 something();

 somethingelse();
 if (some_error)
 do_correct();

 else
 continue_as_usual();
 }
 finalthing();

 ...
 }

 I'm a bit of a heretic myself, I always use braces in if statements, even for 
 one liners. 

me too ( I believe it avoids mistakes when the one statement becomes 2 
- although recent gcc may have a warning for that).

I think I will use the same technique as R to detect those functions
(because it may be a macro or a function; C99 says function, but old
platform and the MS one do not have macro).

cheers,

David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] does numpy have funcs like isanynan() or isallfinite()?

2008-09-06 Thread Robert Kern
On Sat, Sep 6, 2008 at 02:21, dmitrey [EMAIL PROTECTED] wrote:
 hi all,

 does numpy have funcs like isanynan(array) or isallfinite(array)?

No.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
 -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Are the CPP symbols HAVE_LONGDOUBLE_FUNCS and HAVE_FLOAT_FUNCS public ?

2008-09-06 Thread Pauli Virtanen
Sat, 06 Sep 2008 12:15:59 +0900, David Cournapeau wrote:
 On Fri, Sep 5, 2008 at 4:50 PM, Pauli Virtanen [EMAIL PROTECTED] wrote:

 If you remove them, please put a reminder somewhere (eg ticket) to
 update the documentation accordingly.
 
 Is there a reason for not updating the documentation in the patch (well,
 branch) itself ?

Not really. Also that would be OK, just as long as someone remembers to 
do it.

-- 
Pauli Virtanen

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] isnan and co: cleaning up

2008-09-06 Thread David Cournapeau
On Sat, Sep 6, 2008 at 5:40 PM, David Cournapeau
[EMAIL PROTECTED] wrote:
 Charles R Harris wrote:


 This one http://en.wikipedia.org/wiki/Indent_style#K.26R_style


Patch available here: http://scipy.org/scipy/numpy/ticket/907

Tested with gcc on mac os X, it also builds with VS 2003 (but I could
not test there because of another problem with numpy and VS 2003,
unrelated to this).

David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion