Ok I finally got it....

I was going at it backward... Instead of checking for NPY_INT64 and  
trying to figure out which letter it is different on each platform) I  
needed to check for
NPY_LONGLONG /NPY_LONG/ NPY_INT, etc..

i.e I need to check for the numpy types that have an associated unique  
letter. Not their aliases since these can be different...

It works now.

C.


On Sep 8, 2009, at 1:13 PM, Charles سمير Doutriaux wrote:

> Hi Robert,
>
> Ok we have a section of code that used to be like that:
>
>   char t;
>   switch(type) {
>   case NPY_CHAR:
>     t = 'c';
>     break;
> etc...
>
> I now replaced with
>   char t;
>   switch(type) {
>   case NPY_CHAR:
>     t = NPY_CHARLTR;
>     break;
>
> But I'm still stuck with numpy.uint64
> NPY_UINT64LTR does not seem to exist....
>
> What do you recommend?
>
> C.
>
> On Sep 8, 2009, at 1:02 PM, Robert Kern wrote:
>
>> 2009/9/8 Charles سمير Doutriaux <doutria...@llnl.gov>:
>>> Hi,
>>>
>>> I'm testing our code on 64bit vs 32bit
>>>
>>> I just realized that the dtype.car is platform dependent.
>>>
>>> I guess it's normal
>>>
>>> her emy little test:
>>> for t in
>>> [numpy
>>> .byte
>>> ,numpy
>>> .short
>>> ,numpy
>>> .int
>>> ,numpy
>>> .int32
>>> ,numpy
>>> .float
>>> ,numpy
>>> .float32
>>> ,numpy
>>> .double
>>> ,numpy.ubyte,numpy.ushort,numpy.uint,numpy.int64,numpy.uint64]:
>>>    print 'Testing type:',t
>>>    data = numpy.array([0], dtype=t)
>>>    print data.dtype.char,data.dtype
>>>
>>>
>>> On 64bit I get for numpy.unit64:
>>> Testing type: <type 'numpy.uint64'>
>>> L uint64
>>>
>>> Whereas on 32bit i get
>>> Testing type: <type 'numpy.uint64'>
>>> Q uint64
>>>
>>> Is it really normal? I guess that means I shouldn't expect the
>>> dtype.char to be the same on all platform....
>>>
>>> Is that right?
>>
>> Yes. dtype.char corresponds more closely to the C type ("L" ==
>> "unsigned long" and "Q" == "unsigned long long") which is platform
>> specific.
>>
>> -- 
>> Robert Kern
>>
>> "I have come to believe that the whole world is an enigma, a harmless
>> enigma that is made terrible by our own mad attempt to interpret it  
>> as
>> though it had an underlying truth."
>> -- Umberto Eco
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://**mail.scipy.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://*mail.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to