[Numpy-discussion] creating/working NumPy-ndarrays in C++
Tue Apr 3 12:42:50 CDT 2012
Excerpts from Holger Herrlich's message of Tue Apr 03 09:06:09 -0400 2012:
> 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.
Hi Holger -
I put together some header-only classes for this back when I used to do
a lot of C++ and numpy.
They are part of the "esutil" package but you could actually just pull
them out and use them http://code.google.com/p/esutil/
The first is a template class for numpy arrays which can create and
import arrays and keeps track of the reference counts
The second is similar but for void* vectors so the type can be
determined at runtime
There is also one for record arrays
Hope these are useful or can give you some ideas.
Erin Scott Sheldon
Brookhaven National Laboratory
More information about the NumPy-Discussion