[Numpy-discussion] numpy ndarray questions

Jochen cycomanic at gmail.com
Mon Jan 26 20:46:16 EST 2009


On Mon, 2009-01-26 at 19:25 -0600, Ryan May wrote:
> Jochen wrote:
> > Hi all,
> > 
> > I just wrote ctypes bindings to fftw3 (see
> > http://projects.scipy.org/pipermail/scipy-user/2009-January/019557.html
> > for the post to scipy). 
> > Now I have a couple of numpy related questions:
> > 
> > In order to be able to use simd instructions I 
> > create an ndarray subclass, which uses fftw_malloc to allocate the
> > memory and fftw_free to free the memory when the array is deleted. This
> > works fine for inplace operations however if someone does something like
> > this:
> > 
> > a = fftw3.AlignedArray(1024,complex)
> > 
> > a = a+1
> > 
> > a.ctypes.data points to a different memory location (this is actually an
> > even bigger problem when executing fftw plans), however 
> > type(a) still gives me <class 'fftw3.planning.AlignedArray'>.
> 
> This might help some:
> 
> http://www.scipy.org/Subclasses
> 
> Ryan
> 
Thanks, I had read about __array_finalize__, but not about
__array_wrap__. I'm not quite sure if I understand how I can use this to
get around my problem, can you explain?

Cheers
Jochen





More information about the NumPy-Discussion mailing list