[Numpy-discussion] NumPtr vs NumPy.i to access C

Jose Martin maitai02@excite....
Sat May 17 17:55:49 CDT 2008


Hi, I'd like to access a C function from python, and the function takes input/output arrays. I'd probably use SWIG to do the interface to the C code. I found 2 options:
-NumPtr module, to access Numeric arrays as pointers
http://www.penzilla.net/tutorials/python/numptr/
- numpy.i, a SWIG interface file for NumPy that defines typemaps
http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/doc/swig/doc/numpy_swig.html

I'm not sure if there is significant differences between the 2 options (besides using either NumPy or Numeric). Does numpy.i interface file use pointers to access NumPy arrays? or does it make a copy of the array to pass it to/from the C function?

I'm new to programming and I'd like to make sure of this. I need to use in C very large arrays frequently, so I want to avoid making copies of it, because speed will be an important factor.

Thanks in advance! 



_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!




More information about the Numpy-discussion mailing list