Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread Francesc Altet
A Dimecres 20 Desembre 2006 07:59, David Cournapeau escrigué: Could you detail a bit how you did the profiling with oprofile ? I don't manage to get the same results than you (that is on per application basis when the application is a python script and not a 'binary' program) Sure. You need

Re: [Numpy-discussion] slow numpy.clip ?

2006-12-20 Thread Travis Oliphant
My question is then: is there any plan to change this ? If not, is this for some reasons I don't see, or is this just because of lack of manpower ? I raised the possibility of breaking up the files before and Travis was agreeable to the idea. It is still in the back of my

Re: [Numpy-discussion] slow numpy.clip ?

2006-12-20 Thread Travis Oliphant
David Cournapeau wrote: en I went back to home, I started taking a close look a numpy/core C sources, with the help of the numpy ebook. The huge source files make it really difficult for me to follow some things: I was wondering if there is some rationale behind it, or if this is just a

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread David Cournapeau
Francesc Altet wrote: A Dimecres 20 Desembre 2006 07:59, David Cournapeau escrigué: Could you detail a bit how you did the profiling with oprofile ? I don't manage to get the same results than you (that is on per application basis when the application is a python script and not a 'binary'

Re: [Numpy-discussion] slow numpy.clip ?

2006-12-20 Thread David Cournapeau
Travis Oliphant wrote: David Cournapeau wrote: en I went back to home, I started taking a close look a numpy/core C sources, with the help of the numpy ebook. The huge source files make it really difficult for me to follow some things: I was wondering if there is some rationale behind it,

[Numpy-discussion] Type of 1st argument in Numexpr where()

2006-12-20 Thread Ivan Vilata i Balaguer
Hi all, I noticed that the set of ``where()`` functions defined by Numexpr all have a signature like ``xfxx``, i.e. the first argument is a float and the return, second and third arguments are of the same type (whatever it is). Since the first argument effectively represents a condition,

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread Francesc Altet
A Dimecres 20 Desembre 2006 03:36, David Cournapeau escrigué: Francesc Altet wrote: A Dimarts 19 Desembre 2006 08:12, David Cournapeau escrigué: Hi, Following the discussion on clip and other functions which *may* be slow in numpy, I would like to know if there is a way to easily

Re: [Numpy-discussion] slow numpy.clip ?

2006-12-20 Thread Charles R Harris
On 12/20/06, Travis Oliphant [EMAIL PROTECTED] wrote: My question is then: is there any plan to change this ? If not, is this for some reasons I don't see, or is this just because of lack of manpower ? I raised the possibility of breaking up the files before and Travis

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread John Hunter
David == David Cournapeau [EMAIL PROTECTED] writes: David Of this 300 ms spent in Colormap functor, 200 ms are taken David by the take function: this is the function which I think David can be speed up considerably. Sorry I had missed this in the previous conversations. It is

Re: [Numpy-discussion] Type of 1st argument in Numexpr where()

2006-12-20 Thread Tim Hochberg
Ivan Vilata i Balaguer wrote: Hi all, I noticed that the set of ``where()`` functions defined by Numexpr all have a signature like ``xfxx``, i.e. the first argument is a float and the return, second and third arguments are of the same type (whatever it is). Since the first argument

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread Andrew Straw
I added a ticket for Francesc's enhancement: http://projects.scipy.org/scipy/numpy/ticket/403 ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Type of 1st argument in Numexpr where()

2006-12-20 Thread Ivan Vilata i Balaguer
Tim Hochberg (el 2006-12-20 a les 09:20:01 -0700) va dir:: Actually, this is on purpose. Numpy.where (and most other switching constructs in Python) will switch on almost anything. In particular, any number that is nonzero is considered True, zero is considered False. By changing the

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread Travis Oliphant
Francesc Altet wrote: seems to tell us that memmove/memcopy are not called at all, but instead the DOUBLE_copyswap function. This is in fact an apparence, because if we look at the code of DOUBLE_copyswap (found in arraytypes.inc.src): @[EMAIL PROTECTED] (void *dst, void *src, int swap, void

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread Francesc Altet
A Dimecres 20 Desembre 2006 19:32, Andrew Straw escrigué: I added a ticket for Francesc's enhancement: http://projects.scipy.org/scipy/numpy/ticket/403 Thanks Andrew, but I realized that my patch is not safe for dealing with unaligned arrays (Sun machines would segfault). After thinking several

Re: [Numpy-discussion] Type of 1st argument in Numexpr where()

2006-12-20 Thread Tim Hochberg
Ivan Vilata i Balaguer wrote: Tim Hochberg (el 2006-12-20 a les 09:20:01 -0700) va dir:: Actually, this is on purpose. Numpy.where (and most other switching constructs in Python) will switch on almost anything. In particular, any number that is nonzero is considered True, zero is

Re: [Numpy-discussion] Profiling numpy ? (parts written in C)

2006-12-20 Thread Charles R Harris
On 12/20/06, Francesc Altet [EMAIL PROTECTED] wrote: A Dimecres 20 Desembre 2006 03:36, David Cournapeau escrigué: Francesc Altet wrote: A Dimarts 19 Desembre 2006 08:12, David Cournapeau escrigué: Hi, snip @[EMAIL PROTECTED] (void *dst, void *src, int swap, void *arr) {

[Numpy-discussion] Newbie Question, Probability

2006-12-20 Thread Mark Janikas
Hello all, Is there a way to get probability values for the various families of distributions in numpy? I.e. ala R: pnorm(1.96, mean = 0 , sd = 1) [1] 0.9750021 # for the normal pt(1.65, df=100) [1] 0.9489597 # for student t Any suggestions would be greatly

Re: [Numpy-discussion] A question about argmax and argsort

2006-12-20 Thread Tom Denniston
If you want the n largest item i would recommend quicksort but at each partition you only recurse into the side of the pivot that has the values you care about. This is easy to determine because you know how many items are on either side of the pivot and you know that you want the nth item.

Re: [Numpy-discussion] A question about argmax and argsort

2006-12-20 Thread Pierre GM
On Wednesday 20 December 2006 18:02, Tom Denniston wrote: If you want the n largest item i would recommend quicksort ... I don't know of a way to do this in numpy. I think it would require adding a cfunction to numpy. Perhaps an argnth function? Does anyone else know of an existing

Re: [Numpy-discussion] A question about argmax and argsort

2006-12-20 Thread Robert Kern
Pierre GM wrote: On Wednesday 20 December 2006 18:02, Tom Denniston wrote: If you want the n largest item i would recommend quicksort ... I don't know of a way to do this in numpy. I think it would require adding a cfunction to numpy. Perhaps an argnth function? Does anyone else know of

[Numpy-discussion] PyArray_DIMS problem

2006-12-20 Thread Gennan Chen
Hi! I have problem with this function call under FC6 X86_64 for my own numpy extension printf(\n %d %d %d, PyArray_DIM(imgi,0),PyArray_DIM(imgi, 1),PyArray_DIM(imgi,2)) it gave me 166 256 256 if I tried: int *dim; dim = PyArray_DIMS(imgi) printf(\n %d %d %d, dim[0], dim[1], dim[2]);

Re: [Numpy-discussion] PyArray_DIMS problem

2006-12-20 Thread Travis Oliphant
Gennan Chen wrote: Hi! I have problem with this function call under FC6 X86_64 for my own numpy extension printf(\n %d %d %d, PyArray_DIM(imgi,0),PyArray_DIM(imgi,1),PyArray_DIM(imgi,2)) it gave me 166 256 256 if I tried: int *dim; dim = PyArray_DIMS(imgi) printf(\n %d %d %d,

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-20 Thread Alan G Isaac
On Wed, 20 Dec 2006, Robert Kern apparently wrote: We have a full complement of PDFs, CDFs, etc. in scipy. This is my most missed functionality in NumPy. (For now I feel cannot ask students to install SciPy.) Although it is a slippery slope, and I definitely do not want NumPy to slide down

Re: [Numpy-discussion] sum of two arrays with different shape?

2006-12-20 Thread Colin J. Williams
zhang yunfeng wrote: Hi, I'm newbie to Numpy. When reading tutorials at http://www.scipy.org/Tentative_NumPy_Tutorial http://www.scipy.org/Tentative_NumPy_Tutorial, I found a snippet about addition of two arrays with different shape, Does it make sense? If array shapes are not same, why

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-20 Thread Steve Lianoglou
On Dec 20, 2006, at 8:41 PM, Alan G Isaac wrote: On Wed, 20 Dec 2006, Robert Kern apparently wrote: We have a full complement of PDFs, CDFs, etc. in scipy. This is my most missed functionality in NumPy. (For now I feel cannot ask students to install SciPy.) If they're already installing

Re: [Numpy-discussion] PyArray_DIMS problem

2006-12-20 Thread Sebastian Haase
On 12/20/06, Gennan Chen [EMAIL PROTECTED] wrote: Hi! I have problem with this function call under FC6 X86_64 for my own numpy extension printf(\n %d %d %d, PyArray_DIM(imgi,0),PyArray_DIM(imgi,1),PyArray_DIM(imgi,2)) it gave me 166 256 256 if I tried: int *dim; dim =

Re: [Numpy-discussion] PyArray_DIMS problem

2006-12-20 Thread Gennan Chen
Here is the definition of that call from ndarrayobject.h #define PyArray_DIMS(obj) (((PyArrayObject *)(obj))-dimensions) I believe the memory has been allocated. It just return a pointer. Gen On Dec 20, 2006, at 7:43 PM, Sebastian Haase wrote: On 12/20/06, Gennan Chen [EMAIL PROTECTED]

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-20 Thread A. M. Archibald
On 20/12/06, Alan G Isaac [EMAIL PROTECTED] wrote: On Wed, 20 Dec 2006, Robert Kern apparently wrote: We have a full complement of PDFs, CDFs, etc. in scipy. This is my most missed functionality in NumPy. (For now I feel cannot ask students to install SciPy.) Although it is a slippery