[Numpy-discussion] [Swig-user] swig numpy2carray converters

Bill Spotz wfspotz@sandia....
Sat Dec 1 12:13:03 CST 2007


These corrections have been committed.

Thanks.

On Dec 1, 2007, at 9:21 AM, Georg Holzmann wrote:

>> * 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
>>    it.
>
> 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
> wrappers:
>
> ( DATA_TYPE** ARGOUTVIEW_FARRAY1, DIM_TYPE* DIM1 )
> ( DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_FARRAY1 )
>
> which of course do not exist.

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-0154      **
** Albuquerque, NM 87185-0370    Email: wfspotz@sandia.gov **






More information about the Numpy-discussion mailing list