[SciPy-user] C/C++ extension with swig

Robert Cimrman cimrman3 at ntc.zcu.cz
Mon Dec 12 03:16:52 CST 2005


Jaonary Rabarisoa wrote:
> Hi all,
> 
> I'd like to write a python interface for some c/c++ code. I've  
> already done this with the standard way (without swig) and now, I'd  
> like to use swig.
> The code that I like to wrap is like this :
> 
> 	void (double *input, some other args, ...., double *output1, double  
> *output2, ...)
> 
> 
> The input and output arguments represent arrays (matirx, vectors, .nd- 
> arrays, ...). In python, I'd like to passe the argument as a list (or  
> scipy array) of the form
> 
> 	[ [row1], .........., [rowN] ]
> 
> and so the outputs are.
> 
> My problem in the type mapping (Python -> C/C++ and C/C++ -> Python).  
> I found in the swig documentation some hint about this but nowhere  
> there are usefull information on how to use use scipy arrays without  
> pain and transparently. I tryed to follow the example of  
> scipy.cluster.vq but I doesn't work anymore. This issue is already  
> mentionned here.

You can also have a look at scipy/Lib/sandbox/umfpack/umfpack.i, which 
is less complex than the interace file of scipy.cluster.vq. (It might be 
too simple for your purposes, but anyway...)

cheers,
r.



More information about the SciPy-user mailing list