Re: [Numpy-discussion] SWIG and numpy.i

2009-03-30 Thread Kevin Françoisse
Hello Bill, Finaly, I just change my function header to take a double* rather than a double**. It's working fine now. Thank you for all your answer and your help! Swig and numpy.i are really cool when you now how to use it! I also use INPLACE array as a way output 2D arrays from my C function

Re: [Numpy-discussion] SWIG and numpy.i

2009-03-25 Thread Bill Spotz
Kevin, In this instance, the best thing is to write a wrapper function that calls your matSum() function, and takes a double* rather than a double**. You can %ignore the original function and %rename the wrapper so that the python interface gets the name you want. On Mar 25, 2009, at 7:39

Re: [Numpy-discussion] SWIG and numpy.i

2009-03-25 Thread Kevin Françoisse
Thanks Bill, it helps me a lot ! My function works fine now. But I encounter an other problem. This time with a NumPy array of 2 dimensions. Here is the function I want to use : // double matSum(double** mat, int n, int m){ int i,j; double sum = 0.0; for (i=0;i wrote:

Re: [Numpy-discussion] SWIG and numpy.i

2009-03-24 Thread Bill Spotz
Kevin, You need to declare vecSum() *after* you %include "numpy.i" and use the %apply directive. Based on what you have, I think you can just get rid of the "extern double vecSum(...)". I don't see what purpose it serves. As is, it is telling swig to wrap vecSum() before you have set up

[Numpy-discussion] SWIG and numpy.i

2009-03-24 Thread Kevin Françoisse
Hi everyone, I have been using NumPy for a couple of month now, as part of my research project at the university. But now, I have to use a big C library I wrote myself in a python project. So I choose to use SWIG for the interface between both my python script and my C library. To make things mo