Re: [Numpy-discussion] Pointers to arrays in C

2008-06-03 Thread Jose Martin
Thanks for the fast responses! > data. Storing bare pointers in the C side and not holding a > reference to the object providing the data in the C side is really > error prone. It's true, I don't do it because I have to process a large number of arrays, and each has thousands of elements; so

[Numpy-discussion] Pointers to arrays in C

2008-06-03 Thread Jose Martin
Hi, I read a file with array data (one per line), and send the arrays to a module in C. In the C module, I need to store pointers to the arrays, so I don't have to make a copy for each array it receives from python. I found that if I reuse the same variable name to create the array, the pointe

Re: [Numpy-discussion] NumPtr vs NumPy.i to access C

2008-05-18 Thread Jose Martin
Thanks everyone for all the comments! It helped to understand better the advantages/disadvantages of the various options to interact with C. Jose. --- On Sat 05/17, Bill Spotz < [EMAIL PROTECTED] > wrote: Just to make sure the original question gets answered, yes, numpy.i avoids copies as

[Numpy-discussion] NumPtr vs NumPy.i to access C

2008-05-17 Thread Jose Martin
Hi, I'd like to access a C function from python, and the function takes input/output arrays. I'd probably use SWIG to do the interface to the C code. I found 2 options: -NumPtr module, to access Numeric arrays as pointers http://www.penzilla.net/tutorials/python/numptr/ - numpy.i, a SWIG interfa