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

Lou Pecora lou_boog2000 at yahoo.com
Tue Dec 5 09:38:01 CST 2006

Yes, thank you.  I've looked at that, but like several
other examples of typemaps for NumPy in SWIG, I
confess I am having trouble understanding them.  I
have gotten a pure C extension working (sans SWIG)
that takes a Numeric array and I may go that way and
give up on SWIG.  95% of the time (or more) all I need
to do is pass a float numpy array.  I'm beginning to
wonder if the SWIG typemaps and .i files are worth all
the trouble.  

This remains a frustration with Python.  I absolutely
love the language and code as much of my numerical
work in it as I can, but extending it remains a
frustrating barrier.  This despite spending several
full days looking into Guido's tutorial on extensions,
SWIG, and lots of googling.  

Maybe it's me.  Sorry, had to rant a little.

Thanks, again.

-- Lou Pecora

--- Robert Cimrman <cimrman3 at ntc.zcu.cz> wrote:

> afraser wrote:
> > Lou,
> > 
> > I've passed NumPy arrays to C with SWIG.  My code
> is not pretty, but
> > if you don't find what you need, I will send you
> what I've got.
> Also look at
> http://www.scipy.org/Cookbook/SWIG_and_NumPy.
> r.

Any questions? Get answers on any topic at
www.Answers.yahoo.com.  Try it now.

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.

More information about the SciPy-user mailing list