[Numpy-discussion] Numpy and C++ integration...
Lou Pecora
lou_boog2000@yahoo....
Mon Feb 4 10:32:49 CST 2008
Dear Mr. Fulco ,
This may not be exactly what you want to do, but I
would recommend using the C API and then calling your
C++ programs from there (where interface functions to
the C++ code is compiled in the extern "C" {, }
block. I will be doing this soon with my own project.
Why? Because the C interface is doable and, I think,
simple enough that it is better to take the Python to
C++ in two steps. Anyway, worth a look. So here are
two links that show how to use the C API:
http://www.scipy.org/Cookbook/C_Extensions - A short
intro, this also has documentation links
http://www.scipy.org/Cookbook/C_Extensions/NumPy_arrays?highlight=%28%28----%28-%2A%29%28%5Cr%29%3F%5Cn%29%28.%2A%29CategoryCookbook%5Cb%29
- This is an article I wrote last year for the
SciPy.org site and I go into a lot of detail with a
lot of examples on how you pass and handle Numpy
arrays. I think it is (mostly) right and works well
for me.
One warning (which I also talk about in my tutorial)
is to make sure your NumPy arrays are "Continguous",
i.e. the array components are in order in one memory
block. That makes things easier on the C/C++ side.
--- Vince Fulco <vfulco1@gmail.com> wrote:
> Dear Numpy Experts- I find myself working with
> Numpy arrays and
> wanting to access *simple* C++ functions for time
> series returning the
> results to Numpy. As I am a relatively new user of
> Python/Numpy, the
> number of paths to use in incorporating C++ code
> into one's scripts is
> daunting. I've attempted the Weave app but can not
> get past the
> examples. I've also looked at all the other choices
> out there such as
> Boost, SIP, PyInline, etc. Any trailheads for the
> simplest approach
> (assuming a very minimal understanding of C++) would
> be much
> appreciated. At this point, I can't release the
> code however for
> review. Thank you.
>
> --
> Vince Fulco
-- Lou Pecora, my views are my own.
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
More information about the Numpy-discussion
mailing list