[Ilugc] SWIG and Numeric arrays - Python

Ganesh V ae03b007 at iitm.ac.in
Wed Oct 12 17:01:39 IST 2005


   First of all let me know if this is off topic. I will consider posting
this in some other list.

  I want to use Numeric arrays from the SWIG interface, i.e passing and
returning Numeric arrays.


I found this link, but couldn't make much sense out of it. For instance, I
didn't know what "%inline%" meant. And is there any full example that I
can see. All the examples in that site are only parts of the code. I have
no idea as to how to use all those data types. Any body with prior
experience in this area could help me.

  I tried Boost Python, but got stuck right at hello world itself. The
python interface to C using Python.h seemed too long for me. Any other
way to achieve this is also OK for me.

  As regards why I want SWIG and Numeric Python, one could read the

  I have some code that involves a lot of "for" loops. I am a big fan of
Python and hence wrote the code in python. But then I realised it was
too slow. I can't use array slicing here as the job done in one
iteration depends on the previous iteration. So I decided to go for
writing the code in C and wrapping it in Python. I found SWIG to be nice
and easy to use, wrote the C code. But I couldn't use Numeric arrays
that are central to my code.

More information about the ilugc mailing list