Re: [Numpy-discussion] Question about broadcasting vs for loop performance

2014-09-15 Thread Benjamin Root
Broadcasting, by itself, should not be creating large arrays in memory. It uses stride tricks to make the array appear larger, while simply reusing the same memory block. This is why it is so valuable because it doesn't make a copy. Now, what may be happening is that the resulting calculation from

Re: [Numpy-discussion] Linear algebra functions on empty arrays

2014-09-15 Thread josef.pktd
On Mon, Sep 15, 2014 at 7:26 AM, Sebastian Berg wrote: > On Mo, 2014-09-15 at 07:07 -0400, josef.p...@gmail.com wrote: >> On Mon, Sep 15, 2014 at 5:48 AM, Sebastian Berg >> wrote: >> > Hey all, >> > >> > for https://github.com/numpy/numpy/pull/3861/files I would like to allow >> > 0-sized dimensi

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Robert Kern
On Mon, Sep 15, 2014 at 12:31 PM, Eelco Hoogendoorn wrote: > I figured the reference to the object through the local scope would also be > tracked by the GC somehow, since the entire stack frame can be regarded as a > separate object itself, but apparently not. Objects are "tracked", not referenc

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Eelco Hoogendoorn
I figured the reference to the object through the local scope would also be tracked by the GC somehow, since the entire stack frame can be regarded as a separate object itself, but apparently not. On Mon, Sep 15, 2014 at 1:06 PM, Mads Ipsen wrote: > Thanks to everybody for taking time to answer!

Re: [Numpy-discussion] Linear algebra functions on empty arrays

2014-09-15 Thread Sebastian Berg
On Mo, 2014-09-15 at 07:07 -0400, josef.p...@gmail.com wrote: > On Mon, Sep 15, 2014 at 5:48 AM, Sebastian Berg > wrote: > > Hey all, > > > > for https://github.com/numpy/numpy/pull/3861/files I would like to allow > > 0-sized dimensions for generalized ufuncs, meaning that the gufunc has > > to b

Re: [Numpy-discussion] Linear algebra functions on empty arrays

2014-09-15 Thread josef.pktd
On Mon, Sep 15, 2014 at 5:48 AM, Sebastian Berg wrote: > Hey all, > > for https://github.com/numpy/numpy/pull/3861/files I would like to allow > 0-sized dimensions for generalized ufuncs, meaning that the gufunc has > to be able to handle this, but also that it *can* handle it at all. > However la

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Mads Ipsen
Thanks to everybody for taking time to answer! Best regards, Mads On 15/09/14 12:11, Sebastian Berg wrote: > On Mo, 2014-09-15 at 12:05 +0200, Eelco Hoogendoorn wrote: >> >> >> >> On Mon, Sep 15, 2014 at 11:55 AM, Sebastian Berg >> wrote: >> On Mo, 2014-09-15 at 10:16 +0200, Mads Ipsen

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Sebastian Berg
On Mo, 2014-09-15 at 12:05 +0200, Eelco Hoogendoorn wrote: > > > > On Mon, Sep 15, 2014 at 11:55 AM, Sebastian Berg > wrote: > On Mo, 2014-09-15 at 10:16 +0200, Mads Ipsen wrote: > > Hi, > > > > I am trying to inspect the reference count of numpy arrays >

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Robert Kern
On Mon, Sep 15, 2014 at 11:05 AM, Eelco Hoogendoorn wrote: > Does this answer why the ndarray object itself isn't tracked though? I must > say I find this puzzling; the only thing I can think of is that the python > compiler notices that data isn't used anymore after its creation, and > deletes i

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Eelco Hoogendoorn
On Mon, Sep 15, 2014 at 11:55 AM, Sebastian Berg wrote: > On Mo, 2014-09-15 at 10:16 +0200, Mads Ipsen wrote: > > Hi, > > > > I am trying to inspect the reference count of numpy arrays generated by > > my application. > > > > Initially, I thought I could inspect the tracked objects using > > gc.g

Re: [Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Sebastian Berg
On Mo, 2014-09-15 at 10:16 +0200, Mads Ipsen wrote: > Hi, > > I am trying to inspect the reference count of numpy arrays generated by > my application. > > Initially, I thought I could inspect the tracked objects using > gc.get_objects(), but, with respect to numpy objects, the returned > cont

[Numpy-discussion] Linear algebra functions on empty arrays

2014-09-15 Thread Sebastian Berg
Hey all, for https://github.com/numpy/numpy/pull/3861/files I would like to allow 0-sized dimensions for generalized ufuncs, meaning that the gufunc has to be able to handle this, but also that it *can* handle it at all. However lapack does not support this, so it needs some explicit fixing. Also

[Numpy-discussion] Tracking and inspecting numpy objects

2014-09-15 Thread Mads Ipsen
Hi, I am trying to inspect the reference count of numpy arrays generated by my application. Initially, I thought I could inspect the tracked objects using gc.get_objects(), but, with respect to numpy objects, the returned container is empty. For example: import numpy import gc data = numpy.o