[Numpy-discussion] SWIG, typemaps, 2D argout arrays

T J tjhnson@gmail....
Mon Oct 13 23:40:15 CDT 2008


Hi,

I'm new to using SWIG and my reading of numpy_swig.pdf tells me that
the following typemap does not exist:

  (int* ARGOUT_ARRAY2, int DIM1, int DIM2)

What is the recommended way to output a 2D array?  It seems like I should use:

  (int* ARGOUT_ARRAY1, int DIM1)

and then provide a python function which reshapes the 1D array?  Is it
correct that there will be insignificant performance disadvantages to
this?  Also, is there any way to do this in an automated fashion?  My
first thought is that I'd need to create this function outside of the
python module that SWIG creates.

Thanks!


More information about the Numpy-discussion mailing list