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 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 > that are written us

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 wro

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

2009-01-08 Thread Rich E
I am using %includ "sms.h", which is what is wrapping all my functions. Without doing this, I have to hand-wrap every function in the header file! Is there a way to exclude certain definitions from my c header file when using %include, so that I can hand wrap them instead? On Thu, Jan 8, 2009 at

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 s

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

2009-01-06 Thread Matthieu Brucher
2009/1/6 Rich E : > 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 still remaining t

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

2009-01-06 Thread Rich E
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 still remaining though, is it possible to make

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 s

[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