[MATRIX-SIG] Float32 and type conversions.

Nick Patavalis npat@ariadne.di.uoa.gr
Wed, 17 Dec 1997 23:38:24 +0200 (EET)


Hi,

I'm trying to do something like this and it fails:

    a = ones([5,5], Float32)
    a[2:4] = a[2:4] * 0.5

Python prints the error message:

    TypeError: Array can not be safely cast to required type

Of course I understaind what goes wrong! Is there any way
around this problem? Is there any way to make python or NumPy
tread 0.5 (or any other number for that matter) as a float and
not as a double? I'm asking this because it is really important 
for my application to use 'float' and not 'double' arrays.
(It interfaces to a lot of C-code, the arrays are _huge_, and
so on...)

Thanks in advance.
Nick Patavalis
(npat@ariadne.di.uoa.gr)
University of Athens
Athens, Dec 17 1997

P.S. Please also send your answers to my personal address, since I not
   a member of the list (yet!)

   I'm using NumPy v1.0b3 and Python v1.4

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________