[SciPy-User] Problem with passing a 2D Numpy array in the C code by weave.inline

Jose Gomez-Dans jgomezdans@gmail....
Thu Dec 3 05:19:50 CST 2009


Hi,

2009/12/3 Steven Nien <steven.nien@gmail.com>

> I'm trying to pass a 2 dimensional numpy array into the 'weave.inline' and
> doing some computation in C.
> But it seems that the 'weave.inline' will convert a 2d array in python into
> a 1d array in C.
>
> So if I have a MxN array 'arr'
> I need to access arr[2][3] in C by the following code:
>

I think weave inline compiles code into C++ and links against the blitz
libraries, so that numpy arrays are blitz arrays. You can access the element
in your example as arr(2,3). For internal consumption, I guess that the
arrays are still chunks of memory.

J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091203/6c3bd6ff/attachment.html 


More information about the SciPy-User mailing list