[Matrix-SIG] SWIG with recent NumPy

Johann Hibschman johann@physics.berkeley.edu
13 Dec 1999 12:46:38 -0800


Pavlos Christoforou writes:

> I have these, originally from Michael Bell and  Michael Cherkassoff with
> some modifications to make them work with Numerical recipes. But as Johann
> mentioned, you will need to add the import_array() manually.

I just tried it---Rob's suggestion of the %init directive works.
Somehow I'd missed that in the SWIG docs.  Just add the line:

   %init %{ import_array(); %}

to the .i file.

In case it's useful, I've placed my raw, ugly typemap code at:

  <http://astro.berkeley.edu/~johann/python/typemaps.i>

just in case anyone wants to take a look.

-- 
Johann Hibschman                           johann@physics.berkeley.edu