[SciPy-user] numpy array in ctype struct

Matthieu Brucher matthieu.brucher at gmail.com
Mon Jan 21 01:47:37 EST 2008


2008/1/21, Rob Hetland <hetland at tamu.edu>:
>
>
> 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?


No, in fact Paul's example uses [4][4] and this is coded by the compiler
like an int*.


>  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?
>

Definitely on the C side.
I'll try to give you an example today (but no promises)

Matthieu
-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20080121/9ecd668a/attachment.html>


More information about the SciPy-User mailing list