[SciPy-User] Examples how to call NumPy from C++
Chris Barker
chris.barker at noaa.gov
Wed Aug 12 16:58:54 EDT 2015
On Tue, Aug 11, 2015 at 3:54 AM, Alexander Kalinin <alec.kalinin at gmail.com>
wrote:
> Dear SciPy users,
>
> I have some software in C++. A want to call NumPy python procedures from
> C++, for example some matrix multiplication procedures.
>
> Does anybody know some examples how to pass arrays from C++ to NumPy and
> call procedure like matrix multiplication?
>
Step one -- figure out how to call Python from C++ -- look for "embedding"
-- though you may be better off hosting the process with Python, and and
callig teh C++ code from there, it's generally easier.
Step two-- figure out how to get C+= and Python (numpy) to "talk" to each
other.
This can be done with the C API and numpy's C API -- and it is not too
hard, but most of us find it easier and less error-prone to use a tool for
the interface.
I think Cython is the best option, but as C++ person, you may prefer
boost-python
Have fun!
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150812/6bc2b259/attachment.html>
More information about the SciPy-User
mailing list