[SciPy-User] SWIG + numpy and data types

Ignacio Vergara nolambar@gmail....
Wed Feb 10 17:44:23 CST 2010


I hope this is the correct mailing list for this.

I'm using SWIG to create a module for Python+numpy for a legacy and highly
optimized C code.

The function takes 2 array arguments (different sizes) and returns a third
array. But I've been unable to define the interface file.

The function definition is

void cLandscape(int N, int* interactions, float* contributions, float*

where interactions is a N*(N+1) array, contributions is another array of
length 2^(K+1) [0 <= K <= N-1] and landscape is the returned array of length
2^N. So N is the only relevant length.

The function loops over 2^N to fill the landscape array.

The interface typemap line looks like this

%apply (int DIM1, int* IN_ARRAY1, float* IN_ARRAY1, float* ARGOUT_ARRAY1)
{(int N, int* interactions, float* contributions, float* landscape)}

Thanks in advance for any tip and help ;)

Ignacio Vergara Kausel
Bachelor in Science, Physics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100210/e0cf7a5f/attachment.html 

More information about the SciPy-User mailing list