[SciPy-user] numpy array in ctype struct

Rob Hetland hetland@tamu....
Sun Jan 20 17:03:47 CST 2008


On Jan 20, 2008, at 10:01 AM, Matthieu Brucher wrote:

> This function signature suppose that you will access an element by  
> data[i][j] which is not the way Numpy works.

This seems to be the way the example attached by Paul Kienzle works,  
albeit for fixed size arrays.  Would there be a way to dynamically  
set the size for the fixed array, based on other input integers?


>  You can create a wrapper function that will allocate a double** 1D  
> array pointing to the adequate *double (start of a line), pass it  
> to your function and then deallocate the array when returning from  
> the function.


Can you show an example?  I tried to do something similar, but failed  
(due to poor coding skills..).  Also, is it better to create the  
needed list of pointers on the python side, or the C side?

I've had this sort of problem a few times, and I can't seem to find a  
general solution anywhere.  Any advice would help,

-Rob

----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331




More information about the SciPy-user mailing list