[SciPy-User] Problem with passing a 2D Numpy array in the C code by weave.inline
Dag Sverre Seljebotn
Thu Dec 3 08:31:35 CST 2009
Steven Nien wrote:
> I use the following code, and it works.
> inline(code,['arr'], verbose = 1, compiler = 'gcc', type_converters =
> But it works in the arr(i,j) syntax.
> Is there any way to use the original C syntax ( arr[i][j] ) ?
arr[i][j] fundamentally access something else than a NumPy array. NumPy
arrays are blocks of memory indexed by indexes and strides, while
arr[i][j] refer to a double-pointer-indirection style array. I.e. they
are simply not the same thing, and the answer is no.
I'd use a regex search&replace. Alternatively, you can get what you want
with a custom written C++ class (with an operator overload which defines
 in the way you need it).
More information about the SciPy-User