Accessing data buffers in numpy scalars

Francesc Altet faltet at
Tue Oct 17 11:07:19 CDT 2006


I'm looking for an easy way to access the data area of the numpy scalars no 
matter its type.  I've seen that numpy/arrayscalars.h define a structure for 
each scalar type, so I'd guess that it will not be possible to find a general 
way for accessing the data buffer for each type. So, I've decided to look for 
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 
structure to access the data buffer.

2.- Fetch the buffer in and use the buffer protocol in order 
to access the pointer to data in memory. However, I lack experience in buffer 
protocol, so suggestions for achieving this are welcome.

If there is some other trivial way that I haven't devised (specially if usable 
from pyrex), please tell me about.


>0,0<   Francesc Altet
V   V   Cárabos Coop. V.   Enjoy Data

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

More information about the Numpy-discussion mailing list