Re: [Numpy-discussion] argsort in descending order

2008-09-05 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

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

2008-09-05 Thread Charles R Harris
On Fri, Sep 5, 2008 at 9:15 PM, David Cournapeau <[EMAIL PROTECTED]> wrote: > On Sat, Sep 6, 2008 at 8:38 AM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > > > +1, but (putting on pedant hat) I think the functions should be formatted > in > > the way revealed to us by K&R. > > By K&R, you mean

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

2008-09-05 Thread David Cournapeau
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 ? cheers, David ___

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

2008-09-05 Thread David Cournapeau
On Sat, Sep 6, 2008 at 8:38 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: > > +1, but (putting on pedant hat) I think the functions should be formatted in > the way revealed to us by K&R. By K&R, you mean the K&R style, right , not the K&R function declaration style ? :) cheers, David

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

2008-09-05 Thread Charles R Harris
On Thu, Sep 4, 2008 at 11:06 PM, David Cournapeau < [EMAIL PROTECTED]> wrote: > Hi, > >While working on my branch to clean the math configuration, I > noticed that the code for isnan and co became quite convoluted. autoconf > info file has a mention of it, and suggests the following for > port

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread SimonPalmer
thank you very much, deliciously satisfying On Sep 5, 3:33 pm, Zachary Pincus <[EMAIL PROTECTED]> wrote: > > Hi, probably a basic question, but I'm looking for a neat way to sum > > all the positive values in an array of floats.  I'm currently doing it > > the hard way, but am hoping there is some

Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread Ryan May
Thanks a bunch for getting these done. David Huard wrote: > Done in r5790. > > On Fri, Sep 5, 2008 at 12:36 PM, Ryan May <[EMAIL PROTECTED] > > wrote: > > David Huard wrote: > > Hi Ryan, > > > > I applied your patch in r5788 on the trunk. > > I

Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread David Huard
Done in r5790. On Fri, Sep 5, 2008 at 12:36 PM, Ryan May <[EMAIL PROTECTED]> wrote: > David Huard wrote: > > Hi Ryan, > > > > I applied your patch in r5788 on the trunk. > > I noticed there was another bug occurring when both converters and > > usecols are provided. > > I've added regression test

Re: [Numpy-discussion] argsort in descending order

2008-09-05 Thread Charles R Harris
On Fri, Sep 5, 2008 at 8:02 AM, SimonPalmer <[EMAIL PROTECTED]> 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? You'll just have to reverse the indices. Chuck __

Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread Ryan May
David Huard wrote: > Hi Ryan, > > I applied your patch in r5788 on the trunk. > I noticed there was another bug occurring when both converters and > usecols are provided. > I've added regression tests for both bugs. Could you confirm that > everything is fine on your side ? > I can confirm tha

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread Keith Goodman
On Fri, Sep 5, 2008 at 9:08 AM, David Cournapeau <[EMAIL PROTECTED]> wrote: > On Fri, Sep 5, 2008 at 11:52 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > >> Here's another difference: >> a = np.random.randn(10) timeit np.sum(a[np.where(a>0)]) >> 100 loops, best of 3: 3.44 ms per loop

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread David Cournapeau
On Fri, Sep 5, 2008 at 11:52 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > Here's another difference: > >>> a = np.random.randn(10) >>> timeit np.sum(a[np.where(a>0)]) > 100 loops, best of 3: 3.44 ms per loop >>> timeit a[a > 0].sum() > 100 loops, best of 3: 2.21 ms per loop But you're not c

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread Keith Goodman
On Fri, Sep 5, 2008 at 7:32 AM, David Cournapeau <[EMAIL PROTECTED]> wrote: > Ludwig wrote: >> What are the relative merits of >> >> sum(a[where(a>0]) >> >> to >> >> a[a > 0].sum() >> >> ? >> Second one is more OO, takes a few keystrokes less to type. Is there >> any real difference if it came to v

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread David Cournapeau
Ludwig wrote: > What are the relative merits of > > sum(a[where(a>0]) > > to > > a[a > 0].sum() > > ? > Second one is more OO, takes a few keystrokes less to type. Is there > any real difference if it came to very large arrays? Or is it 'just' a > style question? In this case, it is style: sum(

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread Ludwig
What are the relative merits of sum(a[where(a>0]) to a[a > 0].sum() ? Second one is more OO, takes a few keystrokes less to type. Is there any real difference if it came to very large arrays? Or is it 'just' a style question? Ludwig 2008/9/5 Zachary Pincus <[EMAIL PROTECTED]> > > > > Hi, pro

Re: [Numpy-discussion] sum of positive values in an array

2008-09-05 Thread Zachary Pincus
> > Hi, probably a basic question, but I'm looking for a neat way to sum > all the positive values in an array of floats. I'm currently doing it > the hard way, but am hoping there is some cunning and elegant syntax I > can use instead Fancy indexing's my favorite cunning and elegant syntax: a =

Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread David Huard
Hi Ryan, I applied your patch in r5788 on the trunk. I noticed there was another bug occurring when both converters and usecols are provided. I've added regression tests for both bugs. Could you confirm that everything is fine on your side ? Thanks, On Thu, Sep 4, 2008 at 4:47 PM, Ryan May <[EMA

[Numpy-discussion] argsort in descending order

2008-09-05 Thread SimonPalmer
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? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] sum of positive values in an array

2008-09-05 Thread SimonPalmer
Hi, probably a basic question, but I'm looking for a neat way to sum all the positive values in an array of floats. I'm currently doing it the hard way, but am hoping there is some cunning and elegant syntax I can use instead ___ Numpy-discussion mailing

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread David Cournapeau
Miroslav Sabljic wrote: > > Yes it looks so, but as this is first time I'm building numpy I wasn't > sure. I will now experiment further and try to build it with MKL. Tnx > for your help, I really appreciate it! > You should first test the binary (import numpy; numpy.test()), to see whether the

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread Miroslav Sabljic
On 9/5/08, David Cournapeau <[EMAIL PROTECTED]> wrote: > This is not an error per se: fortran compiler is not mandatory. You will > not get all the features of numpy, but you will get a working numpy > without a fortran compiler. Looking at your build.log, it looks like it > built successfully, no

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread David Cournapeau
Miroslav Sabljic wrote: > > The build log is in attachment. Now I just have to see about this > error message I'm getting, "don't know how to compile Fortran code on > platform 'nt'". > This is not an error per se: fortran compiler is not mandatory. You will not get all the features of numpy, b

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread David Cournapeau
Miroslav Sabljic wrote: > > > Thanks for the info. It would certanly be bad news for me if numpy > really can't be build with VS 2008. I will try with numpy 1.1.1 and > see what happens. > The code itself will have to be buildable with VS 2008 (if only because of python 2.6, for which VS 2008 w

Re: [Numpy-discussion] Getting a numpy array from a ctype pointer

2008-09-05 Thread Paulo J. S. Silva
> x = np.frombuffer(int_asbuffer(C.addressof(x.contents), n*8)) I'll go with your faster solution. Very good. Thank you very much. Paulo ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-disc

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread Miroslav Sabljic
On 9/5/08, David Cournapeau <[EMAIL PROTECTED]> wrote: > First, you are trying to build with numpy 1.0.2, which is really old. > Update to a more recent version. Yes, 1.0.2 is the version we are using on Linux so I went with that one. I will try newer version. > The error you are seeing may ind

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread David Cournapeau
Francesc Alted wrote: > > IIRC, Python 2.4 and 2.5 only supports the VS2003 of the MS series of > compilers. With Python 2.6 and 3.0 I think that VS2008 will be the one > supported. > Yes, but that's just stupid when you think about it. I mean, the python code to deal with VS 2008 is there,

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread Francesc Alted
A Friday 05 September 2008, David Cournapeau escrigué: > Matthieu Brucher wrote: > > You may be right, I remember that VS2003 is hardcoded in some > > places in distutils. I think I ran into this issue some months ago > > as well. > > Mmmh, wonder if I could get around that in numscons :) IIRC, Py

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread David Cournapeau
Matthieu Brucher wrote: > > You may be right, I remember that VS2003 is hardcoded in some places > in distutils. I think I ran into this issue some months ago as well. > Mmmh, wonder if I could get around that in numscons :) cheers, David ___ Numpy-

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread Matthieu Brucher
> The error you are seeing may indicate that it is not possible to build > python 2.5 extensions with VS 2008 with distutils (the message says > distutils did not detect VS 2008 installation, and that may well be > caused by distutils not knowing how to deal with VS 2008). You may be right, I reme

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread David Cournapeau
Miroslav Sabljic wrote: > > I have tried building it with empty site.cfg file as you told me. The > log file is in attachment. > > First, you are trying to build with numpy 1.0.2, which is really old. Update to a more recent version. The error you are seeing may indicate that it is not possibl

Re: [Numpy-discussion] numpy build on windows

2008-09-05 Thread Miroslav Sabljic
On 9/4/08, David Cournapeau <[EMAIL PROTECTED]> wrote: > On windows, if you only build numpy, you only need a C compiler, so in > theory, python setup.py build, with an empty site.cfg, should work. > But VS 2008 is significantly different from VS 2003, which is the most > often used MS compiler to

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

2008-09-05 Thread Pauli Virtanen
Fri, 05 Sep 2008 15:27:56 +0900, David Cournapeau wrote: > Those two symbols are mentioned in the numpy C-API book, but with my > work on cleaning the math configuration, those are not needed by numpy > anymore (I grep into numpy and scipy sources, and they are only used in > umathmodule.c.src,