need an example of Python numarray to C++ and back again, Boost / SWIG?
Fernando Perez
fperez.net at gmail.com
Wed Nov 9 23:59:56 EST 2005
PL wrote:
> I want to pass a 2D array from Python to C++, manipulate it in C++ (for
> example, add 1 to each element) and pass it back to Python.
>
> With these building blocks I will be able to figure out all the rest of
> what I need to do for my project. I am very familiar with Python, but
> less so with C++ and Boost or SWIG.
>
> Does anyone have an example with all steps that I can follow? More
> specifically I am looking for the C++ code, ".i" file for SWIG and/or
> the analagous setup files that Boost would need to do this.
You may want to look into weave.inline or weave.blitz, from scipy. Typemaps for
conversion to blitz++ were recently posted on the scipy list:
http://aspn.activestate.com/ASPN/Mail/Message/numpy-discussion/2883831
In particular look at Stefan's post.
For info on weave, here you can find some old slides and example code:
http://amath.colorado.edu/faculty/fperez/python/
Cheers,
f
More information about the Python-list
mailing list