Re: wrapping C functions in python

2008-04-10 Thread Robert Kern
Paul Anton Letnes wrote: > Brian and Diez: > > First of all, thanks for the advice. > > Brian: > > I have installed NumPy and SciPy, but I can't seem to find a wavelet > transform there. Well, you will definitely want to use numpy arrays instead of lists or the standard library's arrays to c

Re: wrapping C functions in python

2008-04-10 Thread Ivan Illarionov
On Apr 10, 9:57 am, Paul Anton Letnes <[EMAIL PROTECTED]> wrote: [...] > , but as I mentioned, it seems to be a bit complicated to wrap heavy > data structures like arrays. Hello, I suggest that you might take a look at how other people solved the same problems. The great example is path.c insi

Re: wrapping C functions in python

2008-04-10 Thread Jaap Spies
Paul Anton Letnes wrote: > Hi, and thanks. > > > However, being a newbie, I now have to ask: What is SWIG? I have heard > the name before, but haven't understood what it is, why I need it, or > similar. Could you please supply some hints? > [...] >>> >>> I am a "scientific" user of Python, and

Re: wrapping C functions in python

2008-04-10 Thread Diez B. Roggisch
Paul Anton Letnes schrieb: > Brian and Diez: > > First of all, thanks for the advice. > > Brian: > > I have installed NumPy and SciPy, but I can't seem to find a wavelet > transform there. > > The main point of this was more to learn C wrapping than to actually get > a calculation done. I wil

Re: wrapping C functions in python

2008-04-09 Thread Paul Anton Letnes
Brian and Diez: First of all, thanks for the advice. Brian: I have installed NumPy and SciPy, but I can't seem to find a wavelet transform there. The main point of this was more to learn C wrapping than to actually get a calculation done. I will probably be starting a PhD soon, doing real

Re: wrapping C functions in python

2008-04-09 Thread Brian Cole
SWIG is a program that automatically generates code to interface Python (and many other languages) with C/C++. If you plan to create lasting software libraries to be accessed from Python and C it is quite a robust way to do so. Essentially, you feed it header files, compile your code and the code

Re: wrapping C functions in python

2008-04-09 Thread Paul Anton Letnes
Hi, and thanks. However, being a newbie, I now have to ask: What is SWIG? I have heard the name before, but haven't understood what it is, why I need it, or similar. Could you please supply some hints? -Paul Den 9. april. 2008 kl. 22.22 skrev Brian Cole: > We use the following SWIG (www.

Re: wrapping C functions in python

2008-04-09 Thread Diez B. Roggisch
>> I am a "scientific" user of Python, and hence have to write some performance >> critical algorithms. Right now, I am learning Python, so this is a "newbie" >> question. >> >> I would like to wrap some heavy C functions inside Python, specifically a >> wavelet transform. I am beginning to become

Re: wrapping C functions in python

2008-04-09 Thread Brian Cole
We use the following SWIG (www.swig.org) typemap to perform such operations: %typemap(in) (int argc, char **argv) { if (!PySequence_Check($input)) { PyErr_SetString(PyExc_ValueError,"Expected a sequence"); return NULL; } $1 = PySequence_Length($input); $2 = (char**)alloca($1*sizeof

wrapping C functions in python

2008-04-09 Thread Paul Anton Letnes
Hello etc. I am a "scientific" user of Python, and hence have to write some performance critical algorithms. Right now, I am learning Python, so this is a "newbie" question. I would like to wrap some heavy C functions inside Python, specifically a wavelet transform. I am beginning to bec