Re: [Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread James Bergstra
I'm stumped. I can't figure out how to extract from e.g. view = A[:, 3] that the view starts at element 3 of A. I was planning to make a may_share_memory implementation based on the idea of swapping in a buffer of 0s, and using the shapes, strides, itemsize etc. to increment just the parts of the

Re: [Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread James Bergstra
Thanks, this is exactly what I was looking for. I'll look into what this Diophantine equation is. Also, relatedly, a few months ago Julian Taylor at least wrote what was there in C, which made it faster, if not better. - James On Fri, Sep 6, 2013 at 1:27 PM, Robert Kern wrote: > On Fri, Sep 6,

[Numpy-discussion] Join and stacking for structured arrays

2013-09-06 Thread Aldcroft, Thomas
For the astropy Table class (which wraps numpy structured arrays), I wrote functions that perform table joins and concatenate tables along rows or columns. These are reasonably full-featured and handle most of the common needs for these operations. The join function here addresses some limitation

Re: [Numpy-discussion] Really cruel draft of vbench setup for NumPy (.add.reduce benchmarks since 2011)

2013-09-06 Thread Yaroslav Halchenko
FWIW -- updated runs of the benchmarks are available at http://yarikoptic.github.io/numpy-vbench which now include also maintenance/1.8.x branch (no divergences were detected yet). There are only recent improvements as I see and no new (but some old ones are still there, some might be specific to

Re: [Numpy-discussion] Really cruel draft of vbench setup for NumPy (.add.reduce benchmarks since 2011)

2013-09-06 Thread Charles R Harris
On Fri, Sep 6, 2013 at 1:21 PM, Yaroslav Halchenko wrote: > FWIW -- updated runs of the benchmarks are available at > http://yarikoptic.github.io/numpy-vbench which now include also > maintenance/1.8.x branch (no divergences were detected yet). There are > only recent improvements as I see and no

Re: [Numpy-discussion] Really cruel draft of vbench setup for NumPy (.add.reduce benchmarks since 2011)

2013-09-06 Thread josef . pktd
On Fri, Sep 6, 2013 at 3:21 PM, Yaroslav Halchenko wrote: > FWIW -- updated runs of the benchmarks are available at > http://yarikoptic.github.io/numpy-vbench which now include also > maintenance/1.8.x branch (no divergences were detected yet). There are > only recent improvements as I see and no

Re: [Numpy-discussion] Really cruel draft of vbench setup for NumPy (.add.reduce benchmarks since 2011)

2013-09-06 Thread Daπid
On 6 September 2013 21:21, Yaroslav Halchenko wrote: > some old ones are > still there, some might be specific to my CPU here > How long does one run take? Maybe I can run it in my machine (Intel i5) for comparison. ___ NumPy-Discussion mailing list Nu

[Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread James Bergstra
Hi, could someone help me understand why this assertion fails? def test_is(self): a = np.empty(1) b = np.empty(1) if a.data is not b.data: assert id(a.data) != id(b.data) # <-- fail I'm trying to write an alternate may_share_memory function. Thanks, - James _

Re: [Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread James Bergstra
Thanks for the tips! FWIW my guess is that since '.data' is dynamically generated property rather than an attribute, it is being freed and re-allocated in the loop, and once for each of my id() expressions. On Fri, Sep 6, 2013 at 12:32 PM, Charles R Harris wrote: > > > > On Fri, Sep 6, 2013 at

Re: [Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread Robert Kern
On Fri, Sep 6, 2013 at 5:58 PM, James Bergstra wrote: > > I'm stumped. I can't figure out how to extract from e.g. > > view = A[:, 3] > > that the view starts at element 3 of A. I was planning to make a may_share_memory implementation based on the idea of swapping in a buffer of 0s, and using the

Re: [Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread Charles R Harris
On Fri, Sep 6, 2013 at 10:19 AM, James Bergstra wrote: > Hi, could someone help me understand why this assertion fails? > > def test_is(self): > a = np.empty(1) > b = np.empty(1) > if a.data is not b.data: > assert id(a.data) != id(b.data) # <-- fail > > I'm trying to write an

Re: [Numpy-discussion] Funny business with 'is' operator?

2013-09-06 Thread Chris Barker - NOAA Federal
On Fri, Sep 6, 2013 at 9:19 AM, James Bergstra wrote: > def test_is(self): > a = np.empty(1) > b = np.empty(1) > if a.data is not b.data: > assert id(a.data) != id(b.data) # <-- fail > > I'm not familiar with the internals, but: In [27]: a = np.empty(1) In [28]: a.data Out[28

Re: [Numpy-discussion] Funny business with 'is' operator?:

2013-09-06 Thread Nathaniel Smith
The .data attribute is generated on the fly when accessed. So it returns an anonymous temporary that's deallocated as soon as it's no longer needed. a.data is b.data needs both objects, so both get allocated and then compared. In the second one though, each object gets allocated one at a time and

[Numpy-discussion] Networkx graph - numpy array - networkx.has_path() function

2013-09-06 Thread Josè Luis Mietta
Hi experts! I wanna use networkx.has_path(). This is applies, necesary, to a networkx graph. I have a adjacency matrix of a undirected graph (M, wich is a numpy matrix (array of N x N elements)). How can I do for use M in  networkx.has_path()? If I must transform M into a networkx graph: ho

Re: [Numpy-discussion] Weird behavior of gufuncs

2013-09-06 Thread Nathaniel Smith
On Fri, Sep 6, 2013 at 12:09 AM, Jaime Fernández del Río wrote: > Hi all, > > I am seeing some very weird behavior on a gufunc I coded. > > It has a pretty complicated signature: > '(r,c,p),(i,j,k,n),(u,v),(d),(n,q)->(q,r,c)' > > And a single registered loop function, for types: > uint8, uint16,

Re: [Numpy-discussion] numpy 1.8.0b1 mkl test_xerbla failure

2013-09-06 Thread Neal Becker
Charles R Harris wrote: > On Thu, Sep 5, 2013 at 5:34 AM, Neal Becker wrote: > >> Just want to make sure this post had been noted: >> >> Neal Becker wrote: >> >> > Built on fedora linux 19 x86_64 using mkl: >> > >> > build OK using: >> > env ATLAS=/usr/lib64 FFTW=/usr/lib64 BLAS=/usr/lib64 >> LA