[Numpy-discussion] [EXTERNAL] creating/working NumPy-ndarrays in C++
Tue Apr 3 14:55:13 CDT 2012
SWIG can read C or C++ header files and use them to generate wrapper interfaces for a long list of scripting languages. It sounds to me like you want to go the other direction -- i.e. you have a code prototyped in python and you want to convert core kernels to C++, perhaps to improve efficiency? Do I have that right? If so, then SWIG is not your tool.
If efficiency is what you are after, then Cython could work really well. You would start with your existing python code and rename appropriate files to become first draft Cython code -- it should compile right out of the box. You could then start adding efficiencies (typed method arguments, for example). The end result would be Cython, though, not C++.
If C++ is a requirement, it sounds like Jim's numpy extension to boost.python might be your best bet. My biggest issue with boost is the heavy templating resulting in nearly indecipherable compiler error messages.
On Apr 3, 2012, at 7:06 AM, Holger Herrlich wrote:
> Hi, I plan to migrate core classes of an application from Python to C++
> using SWIG, while still the user interface being Python. I also plan to
> further use NumPy's ndarrays.
> The application's core classes will create the ndarrays and make
> calculations. The user interface (Python) finally receives it. C++ OOP
> features will be deployed.
> What general ways to work with NumPy ndarrays in C++ are here? I know of
> boost.python so far.
> Regards Holger
> NumPy-Discussion mailing list
** Bill Spotz **
** Sandia National Laboratories Voice: (505)845-0170 **
** P.O. Box 5800 Fax: (505)284-0154 **
** Albuquerque, NM 87185-0370 Email: firstname.lastname@example.org **
More information about the NumPy-Discussion