[Numpy-discussion] NumPtr vs NumPy.i to access C
Sat May 17 21:35:58 CDT 2008
As you can see, people have different preferences for wrapping C/C++
code. I should also mention that one of the easiest methods if numpy
arrays are involved is ctypes. numpy arrays already have more-or-less
built-in support for talking to ctypes. Details are available here:
The good news is that there are _many_ good options. I also know that
the numpy.i file for handling numpy arrays in SWIG is of high quality
and has decent documentation.
On Sat, May 17, 2008 at 4:55 PM, Jose Martin <email@example.com> wrote:
> 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
> - numpy.i, a SWIG interface file for NumPy that defines typemaps
> 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!
> Numpy-discussion mailing list
More information about the Numpy-discussion