[SciPy-user] How to: Pass NumPy arrays to C & use SWIG to generate modules

Lou Pecora lou_boog2000 at yahoo.com
Fri Dec 1 09:06:57 CST 2006


I have some number crunching routines I want to code
in C or C++ and then use SWIG to create a module I can
import.  I can get the simple example.i stuff in the
SWIG package to work, but I need to pass NumPy arrays
back and forth.  I have looked up typemaps and googled
examples, but whatever I find is pretty general and
high level for me and my needs -- at least until I get
more experience.

Does anyone know of simple examples of passing NumPy
arrays and using SWIG?  I really don't want to branch
out to other objects, yet. No C++ templates or fancy
stuff.  Just NumPy arrays to C arrays (or something
reasonable in C) will get me a long way in my coding
for now.

Thanks for any suggestions or pointers.

-- Lou Pecora
   US Naval Research Lab


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


More information about the SciPy-user mailing list