[SciPy-User] Examples how to call NumPy from C++

Sturla Molden sturla.molden at gmail.com
Wed Aug 12 18:28:43 EDT 2015


Alexander Kalinin <alec.kalinin at gmail.com> wrote:
 
> I have some software in C++. A want to call NumPy python procedures from
> C++, for example some matrix multiplication procedures.

If you want matrix multiplication in C++ you are better off using CBLAS
(e.g. Intel MKL, OpenBLAS, Apple Accelerate Framework), Eigen or BLISS. If
you need more linear algebra there is LAPACKE. 

That said, to call NumPy from C++ you must either embed the Python
interpreter in your C++ program or extend Python with C++. The most
relevant options are Python C API, PyCXX, Boost.Python, SIP, Swig, or
Cython. Personally I prefer PyCXX or Cython, but it is a matter of taste.

Sturla




More information about the SciPy-User mailing list