[SciPy-user] Fast Gauss Transform

Robert Kern robert.kern at gmail.com
Tue Mar 21 14:56:52 CST 2006


David Huard wrote:
> Hi Robert,
> I finally followed the path of least resistance and tried to wrap Yang's
> package using Swig but it seems like I'm out of my depth here. I managed
> to create a python module, but when I call the FastGauss class, it
> complains that the class asks for double * and that it receives a
> numpy.array. I guess the interface I provided is not correct, but I
> couldn't find any example that I could follow step by step. 
> 
> I also tried to wrap the class with f2py, but python complains :
> ImportError: dynamic module does not define init function (initfgt)
> 
> Could this be because the initialization of the c++ class is in the
> header file and f2py seems to ignore it ?

f2py probably won't deal with C++ well. Without seeing the code that you tried,
I can't tell you exactly what went wrong.

> Could you direct me toward the most efficient way to get a working
> python module ? swig ? f2py ?

SWIG is probably easiest given that you are wrapping a C++ class. Recently,
Fernando Pérez contributed some SWIG typemaps that handle simple conversions
between numpy arrays and C pointers. In a recent SVN checkout of numpy, look in
numpy/doc/swig/ for the typemaps and an example.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-user mailing list