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

Dave Kammeyer kammeyer at enthought.com
Sat Dec 2 16:29:21 CST 2006


If they're small routines, you might take a look at Weave, which allows 
you to inline C++ code into Python code with easy access to arrays 
pretty easily.  http://scipy.org/Weave

-Dave


Lou Pecora wrote:
> 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
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>   



More information about the SciPy-user mailing list