Re: [Numpy-discussion] help with typemapping a C function to use numpy arrays

2009-01-09 Thread Rich E
Well I see it works, however with one change: the %apply typemaps need to be done before %include'ing the header file, or else nothing in that header file will automatically get typemapped (only the functions that are written using %inline will be typemapped, which in the case of the exampe you

Re: [Numpy-discussion] help with typemapping a C function to use numpy arrays

2009-01-09 Thread Egor Zindy
Hello again! On Sat, Jan 10, 2009 at 7:11 AM, Rich E reakina...@gmail.com wrote: Well I see it works, however with one change: the %apply typemaps need to be done before %include'ing the header file, or else nothing in that header file will automatically get typemapped (only the functions

Re: [Numpy-discussion] help with typemapping a C function to use numpy arrays

2009-01-07 Thread Rich E
Here is my example, trying to wrap the function sms_spectrumMag that we have been dealing with: %apply (int DIM1, float* IN_ARRAY1) {(int sizeInArray, float* pInArray)}; %apply (int DIM1, float* INPLACE_ARRAY1) {(int sizeOutArray, float* pOutArray)}; %inline %{ void my_spectrumMag( int

Re: [Numpy-discussion] help with typemapping a C function to use numpy arrays

2009-01-06 Thread Matthieu Brucher
2009/1/6 Rich E reakina...@gmail.com: This helped immensely. I feel like I am getting close to being able to accomplish what I would like with SWIG: producing a python module that can be very 'python-like', while co-existing with the c library that is very 'c-like'. There is one question

Re: [Numpy-discussion] help with typemapping a C function to use numpy arrays

2009-01-05 Thread Rich E
Egor, Thanks for the help. I think I want to leave the C code as-is however, as it is perfectly fine there no knowing 'sizeOutMag' because it can deduce both array sizes from one variable. There are many other similar cases in my code (many where the size of the array is known by a member of a

[Numpy-discussion] help with typemapping a C function to use numpy arrays

2008-12-23 Thread Rich E
Hi list, My question has to do with the Numpy/SWIG typemapping system. I recently got the typemaps in numpy.i to work on most of my C functions that are wrapped using SWIG, if they have arguments of the form (int sizeArray, float *pArray). Now I am trying to figure out how to wrap function that