[Numpy-discussion] swig numpy2carray converters
Sat Dec 1 10:21:25 CST 2007
> * A new ARGOUTVIEW suite of typemaps is provided that allows your
> wrapped function
> to provide a pointer to internal data and that returns a numpy
> array encapsulating
Thanks for integrating it !
> * New typemaps are provided that correctly handle FORTRAN ordered 2D
> and 3D arrays.
I have some problem with your FORTRAN implementation.
The problem is how you set the flags in numpy.i "int
require_fortran(PyArrayObject* ary)" (~ line 402).
You do it like this:
ary->flags = ary->flags | NPY_F_CONTIGUOUS;
which does not work (at least on my computer) - I still get usual
C-ordered arrays returned.
However, it does work if you set the flags like this:
ary->flags = NPY_FARRAY;
> Tests for the ARGOUTVIEW and FORTRAN ordered arrays have also been
> added, and the documentation (doc/numpy_swig.*) has been updated to
> reflect all of these changes.
A small typo: in the docs you also write about 1D FORTRAN ARGOUTVIEW
( DATA_TYPE** ARGOUTVIEW_FARRAY1, DIM_TYPE* DIM1 )
( DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_FARRAY1 )
which of course do not exist.
More information about the Numpy-discussion