From: Francesc A. <fa...@op...> - 2003-01-21 19:23:38
|
A Dimarts 21 Gener 2003 19:41, Sebastian Haase va escriure: > Hi, > I think this is actually quite related to my post from Friday: > [Numpy-discussion] make C array accessible to python without copy > > -> So, to reformulate: Who hold actually the array data in memory? Or: > where gets the memory allocated and where/how many pointers to that exi= st?=20 > I understood the answer that Todd Miller gave, that there is such a t= hing > as a "buffer object" that does all the work, so then: one would just ha= ve > to take that and build a "new" numarray or Numeric structure around it=20 > (referring to the Subject of this email) or (in the case of my > Friday-email) just have that "buffer object" point to a different memo= ry > space (that got already allocated by the C-program) . > > Agree ? (Did I get it right?) Well, so so. I think the buffer object is a property of numarray objects, not Numeric objects. So, in the numarray =3D=3D> Numeric conversion proce= ss you may need to access the internals of the buffer (for example by using the high level numarray C-API) and manage to obtain a data buffer (in the C sense, not an object) that can be used to build the Numeric object (with = the help of the numarray object metadata). The opposite way needs something similar but with inverted roles. See my previous message for a more in-de= pth explanation. I think the conversion (without copying) is not a difficult process, but = no so-easy like that. Well, I'm just a newcomer to numarray and my opinions about that may perfectly be completely wrong, of course. Take them with caution!. --=20 Francesc Alted |