[Numpy-discussion] ndimage.label - howto force SWIG to use int32 - even on 64bit Linux ?

Bill Spotz wfspotz@sandia....
Wed Apr 28 16:51:52 CDT 2010


Both types of typemaps are enabled, so you just need to do you %apply  
directives correctly:

   %apply (npy_intp* IN_ARRAY1, int DIM1) {(npy_intp* seq, int n)};
   etc....

SWIG should be able to figure it out from there.

On Apr 28, 2010, at 12:58 PM, Charles R Harris wrote:

> On Tue, Apr 27, 2010 at 2:27 AM, Sebastian Haase  
> <seb.haase@gmail.com> wrote:
> Hi,
> I wanted to write some C code to accept labels as they come from  
> ndimage.label.
> For some reason ndimage.label produces its output as an int32 array -
> even on my 64bit system .
>
> BTW, could this be considered a bug ?
>
>
> Likely.
>
> Now, if I use the typemaps of numpy.i I can choose between NPY_LONG  
> and NPY_INT.
> But those are sometimes 32 sometimes 64 bit, depending on the system.
>
> Any ideas ... ?
>
> npy_intp.
>
> Chuck

** 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