Re: [Numpy-discussion] Owndata flag

2011-12-23 Thread Gael Varoquaux
On Thu, Dec 15, 2011 at 04:36:24PM +, Robert Kern wrote: More explicitly, I have some temporary home-made C structure that holds a pointer to an array. I prepare (using Cython) an numpy.ndarray using the PyArray_NewFromDescr function. I can delete my temporary C structure without

Re: [Numpy-discussion] Owndata flag

2011-12-18 Thread Travis Oliphant
[snip] Devs, looking into this, I noticed that we use PyDataMem_NEW() and PyDataMem_FREE() (which is #defined to malloc() and free()) for handling the data pointer. Why aren't we using the appropriate PyMem_*() functions (or the PyArray_*() memory functions which default to using the

Re: [Numpy-discussion] Owndata flag

2011-12-16 Thread Fabrice Silva
Le jeudi 15 décembre 2011 à 18:09 +0100, Gregor Thalhammer a écrit : There is an excellent blog entry from Travis Oliphant, that describes how to create a ndarray from existing data without copy: http://blog.enthought.com/?p=62 The created array does not actually own the data, but its base

Re: [Numpy-discussion] Owndata flag

2011-12-16 Thread Gregor Thalhammer
Am 16.12.2011 um 11:53 schrieb Fabrice Silva: Le jeudi 15 décembre 2011 à 18:09 +0100, Gregor Thalhammer a écrit : There is an excellent blog entry from Travis Oliphant, that describes how to create a ndarray from existing data without copy: http://blog.enthought.com/?p=62 The created

Re: [Numpy-discussion] Owndata flag

2011-12-16 Thread Fabrice Silva
Le vendredi 16 décembre 2011 à 15:33 +0100, Gregor Thalhammer a écrit : Even better: the addendum! http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ Within cython: cimport numpy numpy.set_array_base(my_ndarray,

Re: [Numpy-discussion] Owndata flag

2011-12-16 Thread Dag Sverre Seljebotn
On 12/16/2011 04:16 PM, Fabrice Silva wrote: Le vendredi 16 décembre 2011 à 15:33 +0100, Gregor Thalhammer a écrit : Even better: the addendum! http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/ Within cython: cimport numpy

[Numpy-discussion] Owndata flag

2011-12-15 Thread Fabrice Silva
How can one arbitrarily assumes that an ndarray owns its data ? More explicitly, I have some temporary home-made C structure that holds a pointer to an array. I prepare (using Cython) an numpy.ndarray using the PyArray_NewFromDescr function. I can delete my temporary C structure without freeing

Re: [Numpy-discussion] Owndata flag

2011-12-15 Thread Robert Kern
On Thu, Dec 15, 2011 at 16:17, Fabrice Silva si...@lma.cnrs-mrs.fr wrote: How can one arbitrarily assumes that an ndarray owns its data ? More explicitly, I have some temporary home-made C structure that holds a pointer to an array. I prepare (using Cython) an numpy.ndarray using the

Re: [Numpy-discussion] Owndata flag

2011-12-15 Thread Gregor Thalhammer
Am 15.12.2011 um 17:17 schrieb Fabrice Silva: How can one arbitrarily assumes that an ndarray owns its data ? More explicitly, I have some temporary home-made C structure that holds a pointer to an array. I prepare (using Cython) an numpy.ndarray using the PyArray_NewFromDescr function. I

Re: [Numpy-discussion] OWNDATA flag and reshape() -- views vs. copies

2008-04-19 Thread Eric Firing
Guillaume Desjardins wrote: I'm pretty new to Python and numpy (longtime c / matlab programmer), but after a read through some of the past threads and Travis' Guide to Numpy, I think I have a fairly good understanding of how the reshape() function / methods work, with regards to views and