[Numpy-discussion] Wrapping C array

Todd Miller jmiller at stsci.edu
Wed May 18 08:31:21 EDT 2005


On Wed, 2005-05-18 at 04:01, Alexandre wrote:
> On Tue, May 17, 2005 at 09:36:22PM -0300, Carlos Pita wrote:
> > Hi!
> > I need to wrap a pre-existent C array into
> > a numarray. It shouldn't be a copy of the
> > original array because this is an audio buffer
> > with a fixed address and also input/output
> > copying from/to the buffer would be overkilling,
> > so the numarray *must* be lightly wrapping the
> > buffer and not a memcpy of it. But NA_NewArray
> > duplicates the passed buffer so I'm not sure
> > how to achieve the goal stated above or if
> > it's possible at all.
> > Can you help me?
> 
> I'm not sure for Numarray, but for Numeric, you can use
> PyArray_FromDimsAndData(). There should be a similar function in
> numarray.  

That function does indeed exist for Numeric and has non-copying
semantics.

Regards,
Todd





More information about the NumPy-Discussion mailing list