From: Francesc A. <fa...@ca...> - 2006-10-17 16:07:38
|
Hi, I'm looking for an easy way to access the data area of the numpy scalars no= =20 matter its type. I've seen that numpy/arrayscalars.h define a structure fo= r=20 each scalar type, so I'd guess that it will not be possible to find a gener= al=20 way for accessing the data buffer for each type. So, I've decided to look f= or=20 a workaround and I've devised a couple of possibilities: 1.- Promote the scalar type to a ndarray object and use the regular ndarray= C=20 structure to access the data buffer. 2.- Fetch the buffer in scalartype.data and use the buffer protocol in orde= r=20 to access the pointer to data in memory. However, I lack experience in buff= er=20 protocol, so suggestions for achieving this are welcome. If there is some other trivial way that I haven't devised (specially if usa= ble=20 from pyrex), please tell me about. TIA, =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |