[Numpy-discussion] Question about bounds checking

2009-08-10 Thread Rich E
Dear all, I am having a few issues with indexing in numpy and wondered if you could help me out. If I define an array a = zeros(( 4)) a array([ 0., 0., 0., 0.]) Then I try and reference a point beyond the bounds of the array a[4] Traceback (most recent call last): File "", line 1, in IndexE

Re: [Numpy-discussion] default float type of array not accepted by SWIG wrapped C functions

2009-02-06 Thread Rich E
mple of a function prototype you are wrapping, the %apply directive you > use and and example of python code accessing it? > > -Bill > > From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] > On Behalf Of Rich E [

[Numpy-discussion] default float type of array not accepted by SWIG wrapped C functions

2009-01-22 Thread Rich E
Hi all, I have a SWIG wrapped C library that uses 32bit floating point arrays, using the numpy.i typemapping system for passing the arrays. For every array that I make, I have to convert it using astype('float32'), else python complains that I tried to pass a double-precision array. Is there any

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

2009-01-09 Thread Rich E
n my XP/cygwin/mingw32 system, so it could need some tuning on a > different system! > > In all this, not sure where is best to put the %exception statement, but > placement shouldn't be critical, because it concerns the my_ function rather > than the original (or renamed) sms_ functio

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

2009-01-08 Thread Rich E
t; $ swig -version > > SWIG Version 1.3.36 > > Compiled with g++ [i686-pc-cygwin] > Please see http://www.swig.org for reporting bugs and further information > > > > > On Thu, Jan 8, 2009 at 1:43 AM, Rich E wrote: >> >> Here is my example, trying to wrap the fun

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

2009-01-07 Thread Rich E
58 AM, Matthieu Brucher wrote: > 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 >

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

2009-01-06 Thread Rich E
ray: [1, 1, 2, 2, 3, 3, 4, 4] > result: [ 1.41421354 2.82842708 4.2426405 5.65685415] > > array: [1, 1, 2] > result: > Traceback (most recent call last): > File "test_dftmagnitude.py", line 15, in > print "result:",dftmagnitude.spectrumMag(a) > Ind

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

2009-01-05 Thread Rich E
it all makes sense. If you have any questions, don't hesitate! > >>python test_dftmagnitude.py > [1, 1, 2, 2] > [ 1.41421354 2.82842708] > [1, 1, 2, 2, 3, 3, 4, 4] > [ 1.41421354 2.82842708 4.2426405 5.65685415] > [1, 1, 2, 2, 3, 3, 4, 4, 5, 5] > [ 1.41421354 2.8

[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