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

Sebastian Haase seb.haase@gmail....
Thu Apr 29 02:52:35 CDT 2010


Thanks for those replies.
But isn't  npy_intp   about pointers ?
I would need something like    npy_int32  .
But does that exist ?  Where is the list of types that numpy.i supports ?
Also, BTW, is there code duplication if numpy.i supports (let's say)
both npy_int and npy_int32  on a machine, where "int" is already 32
bits by default !? (I'm talking about the size of the resulting object
file, I guess...)

Thanks again for your help,
Sebastian



On Wed, Apr 28, 2010 at 11:51 PM, Bill Spotz <wfspotz@sandia.gov> wrote:
> 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 **
>
>
>
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list