[C++-sig] Using Numpy C API with boost python numeric

Jim Bosch talljimbo at gmail.com
Fri Jan 17 14:49:34 CET 2014


I'm pretty sure the numeric::array stuff doesn't actually use the
NumPy C API, and hence it doesn't call import_array.  It just relies
on the Python interface to NumPy objects, which is why it doesn't
support things like accessing the raw data pointers.  So there
shouldn't be any problem with using the NumPy C API with it.

That said, I think it's always good practice to follow the NumPy C API
docs for multiple source files and define a unique preprocessor symbol
to import the NumPy API with, i.e.:

http://docs.scipy.org/doc/numpy/reference/c-api.array.html#miscellaneous

You may also be interested in this project:

https://github.com/ndarray/Boost.NumPy



Jim


More information about the Cplusplus-sig mailing list