[Numpy-discussion] Numarrays from C arrays without copying

Todd Miller jmiller at stsci.edu
Thu Apr 22 12:09:09 CDT 2004


On Thu, 2004-04-22 at 14:32, Craig Rasmussen wrote:
> On Apr 22, 2004, at 10:46 AM, Sebastian Haase wrote:
> 
> >    obj = PyBuffer_FromReadWriteMemory(theRing.bufferPtr(),
> > theRing.bufferSize());
> >    obj2 =(PyObject*) NA_NewAllFromBuffer( 4, shape, tUInt16, obj, 0, 0,
> > NA_ByteOrder(), 1, 1/*writable*/) ;
> 
> It looks like this will work.
> 

It'll definitely work.  I'd forgotten about it.

> I thought Todd had been saying that this wasn't possible.  Perhaps I
> did not phrase my question very well when I asked earlier.

Nope,  your question was fine.

I'm hopeful that PyArray_FromDimsAndData can be improved 
so that this becomes easier for numarray-1.0.

Regards,
Todd
-- 
Todd Miller <jmiller at stsci.edu>





More information about the Numpy-discussion mailing list