[Numpy-discussion] datetime-related import slowdown

2009-09-07 Thread David Cournapeau
Hi, I noticed that numpy import times significantly are significantly worse than it used to be, and those are related to recent datetime related changes: # One month ago time python -c import numpy - 141ms # Now: time python -c import numpy - 202ms Using bzr import profiler, most of the

[Numpy-discussion] numpy/scipy/matplotlib + 10.6 + Apple python 2.6.1

2009-09-07 Thread George Nurser
There are some interesting instructions on how to make this work at http://blog.hyperjeff.net/?p=160. However I'm not sure that the recommendation to rename the Apple-supplied version of numpy is consistent with previous advice I've seen on this mailing list. --George Nurser.

Re: [Numpy-discussion] numpy/scipy/matplotlib + 10.6 + Apple python 2.6.1

2009-09-07 Thread David Cournapeau
On Mon, Sep 7, 2009 at 6:00 PM, George Nursergnur...@googlemail.com wrote: There are some interesting instructions on how to make this work at http://blog.hyperjeff.net/?p=160. However I'm not sure that the recommendation to rename the Apple-supplied version of numpy is consistent with

[Numpy-discussion] Row-wise dot product?

2009-09-07 Thread T J
Is there a better way to achieve the following, perhaps without the python for loop? x.shape (1,3) y.shape (1,3) z = empty(len(x)) for i in range(1): ...z[i] = dot(x[i], y[i]) ... ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Row-wise dot product?

2009-09-07 Thread Nadav Horesh
(x*y).sum(1) Nadav -הודעה מקורית- מאת: numpy-discussion-boun...@scipy.org בשם T J נשלח: ב 07-ספטמבר-09 12:34 אל: Discussion of Numerical Python נושא: [Numpy-discussion] Row-wise dot product? Is there a better way to achieve the following, perhaps without the python for loop?

[Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-07 Thread Robert
Is there a reason why ndarray truth tests (except scalars) deviates from the convention of other Python iterables list,array.array,str,dict,... ? Furthermore there is a surprising strange exception for arrays with size 1 (!= scalars). I often run into exceptions and unexpected bahavior like

Re: [Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-07 Thread Neil Martinsen-Burrell
On 2009-09-07 07:11 , Robert wrote: Is there a reason why ndarray truth tests (except scalars) deviates from the convention of other Python iterables list,array.array,str,dict,... ? Furthermore there is a surprising strange exception for arrays with size 1 (!= scalars). Historically,

[Numpy-discussion] greppable file of all numpy functions ?

2009-09-07 Thread denis bzowy
Does anyone have a program to generate a file with one line per Numpy function / class / method, for local grepping ? It might be useful for any package with thousands of functions too. (Grepping a Pypi summary to see what the heck is ... takes 1 second.) Sorry if this is a duplicate, must exist

Re: [Numpy-discussion] Row-wise dot product?

2009-09-07 Thread Hans-Andreas Engel
From: T J tjhnson at gmail.com Is there a better way to achieve the following, perhaps without the python for loop? x.shape (1,3) y.shape (1,3) z = empty(len(x)) for i in range(1): ...z[i] = dot(x[i], y[i]) ... ___

Re: [Numpy-discussion] Row-wise dot product?

2009-09-07 Thread josef . pktd
On Mon, Sep 7, 2009 at 10:09 AM, Hans-Andreas Engeleng...@deshaw.com wrote: From: T J tjhnson at gmail.com Is there a better way to achieve the following, perhaps without the python for loop? x.shape (1,3) y.shape (1,3) z = empty(len(x)) for i in range(1): ...    z[i] =

Re: [Numpy-discussion] mixing -fno-exceptions with swig c++ wrappers to python

2009-09-07 Thread Rohit Garg
On Sun, Sep 6, 2009 at 8:35 PM, David Cournapeauda...@ar.media.kyoto-u.ac.jp wrote: Rohit Garg wrote: Hi, I am using swig to expose a c++ class to Python. I am wondering if it is safe to use the -fno-exceptions option while compiling the wrappers. I am also using the typemaps present in the

[Numpy-discussion] Choosing the lesser value

2009-09-07 Thread nathanielpeterson08
Let a=np.ma.masked_invalid(np.array([-1,np.nan,-2,-3, np.nan])) b=np.ma.masked_invalid(np.array([-2,-3, -1,np.nan,np.nan])) I'd like to choose the lesser element (component-wise) of a and b. If the two elements are comparable, I want the lesser element. If one element is a number and

Re: [Numpy-discussion] Choosing the lesser value

2009-09-07 Thread Charles R Harris
On Mon, Sep 7, 2009 at 2:46 PM, nathanielpeterso...@gmail.com wrote: Let a=np.ma.masked_invalid(np.array([-1,np.nan,-2,-3, np.nan])) b=np.ma.masked_invalid(np.array([-2,-3, -1,np.nan,np.nan])) I'd like to choose the lesser element (component-wise) of a and b. If the two elements

Re: [Numpy-discussion] greppable file of all numpy functions ?

2009-09-07 Thread David Warde-Farley
numpy.lookfor does what you're looking for, though I know of no such greppable file. You might be able to generate it thusly (untested): import numpy for key in dir(numpy): print key, if getattr(numpy, key).__doc__: print ':', getattr(numpy,

[Numpy-discussion] Behavior from a change in dtype?

2009-09-07 Thread Skipper Seabold
Hello all, I ran into a problem with some of my older code (since figured out the user error). However, in trying to give a simple example that replicates the problem I was having, I ran into this. In [19]: a = np.array((1.)) In [20]: a Out[20]: array(1.0) # the dtype is 'float64' In [21]:

Re: [Numpy-discussion] Row-wise dot product?

2009-09-07 Thread T J
On Mon, Sep 7, 2009 at 3:27 PM, T Jtjhn...@gmail.com wrote: On Mon, Sep 7, 2009 at 7:09 AM, Hans-Andreas Engeleng...@deshaw.com wrote: If you wish to avoid the extra memory allocation implied by `x*y' and get a ~4x speed-up, you can use a generalized ufunc (numpy = 1.3, stolen from the

Re: [Numpy-discussion] Row-wise dot product?

2009-09-07 Thread T J
On Mon, Sep 7, 2009 at 3:43 PM, T Jtjhn...@gmail.com wrote: Or perhaps I am just being dense. Yes. I just tried to reinvent standard matrix multiplication. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Row-wise dot product?

2009-09-07 Thread T J
On Mon, Sep 7, 2009 at 7:09 AM, Hans-Andreas Engeleng...@deshaw.com wrote: If you wish to avoid the extra memory allocation implied by `x*y' and get a ~4x speed-up, you can use a generalized ufunc (numpy = 1.3, stolen from the testcases):   z = numpy.core.umath_tests.inner1d(x, y) This is

Re: [Numpy-discussion] Behavior from a change in dtype?

2009-09-07 Thread josef . pktd
On Mon, Sep 7, 2009 at 6:36 PM, Skipper Seaboldjsseab...@gmail.com wrote: Hello all, I ran into a problem with some of my older code (since figured out the user error).  However, in trying to give a simple example that replicates the problem I was having, I ran into this. In [19]: a =

Re: [Numpy-discussion] mixing -fno-exceptions with swig c++ wrappers to python

2009-09-07 Thread Bill Spotz
numpy.i is supposed to be C-compatible, so it does not generate any throw or catch statements, and utilizes standard python error handling. Using -fno-exceptions should be OK. On Sep 7, 2009, at 12:16 PM, Rohit Garg wrote: On Sun, Sep 6, 2009 at 8:35 PM, David

Re: [Numpy-discussion] Behavior from a change in dtype?

2009-09-07 Thread Skipper Seabold
On Mon, Sep 7, 2009 at 7:35 PM, josef.p...@gmail.com wrote: On Mon, Sep 7, 2009 at 6:36 PM, Skipper Seaboldjsseab...@gmail.com wrote: Hello all, I ran into a problem with some of my older code (since figured out the user error).  However, in trying to give a simple example that replicates

Re: [Numpy-discussion] Behavior from a change in dtype?

2009-09-07 Thread josef . pktd
On Mon, Sep 7, 2009 at 8:01 PM, Skipper Seaboldjsseab...@gmail.com wrote: On Mon, Sep 7, 2009 at 7:35 PM, josef.p...@gmail.com wrote: On Mon, Sep 7, 2009 at 6:36 PM, Skipper Seaboldjsseab...@gmail.com wrote: Hello all, I ran into a problem with some of my older code (since figured out the

Re: [Numpy-discussion] mixing -fno-exceptions with swig c++ wrappers to python

2009-09-07 Thread David Cournapeau
Rohit Garg wrote: Yeah, that's what I meant. If my code does not use exceptions, then is it safe to use -fno-exceptions? You would have to look at g++ documentation - but if it is safe for your code, numpy should not make it unsafe. I am not sure what not using exception means in C++,

Re: [Numpy-discussion] greppable file of all numpy functions ?

2009-09-07 Thread Robert Kern
On Mon, Sep 7, 2009 at 08:26, denis bzowydenis-bz...@t-online.de wrote: Does anyone have a program to generate a file with one line per Numpy function / class / method, for local grepping ? It might be useful for any package with thousands of functions too. (Grepping a Pypi summary to see what