[Numpy-discussion] preventing coercion of matrix

Mathew Yeates mathew at fugue.jpl.nasa.gov
Mon Mar 12 21:54:24 EST 2001


Hi-

I'm using Numpy with GL and came across the following problem.

a=ones((2,2),'f')
print a.itemsize()
#result is 4

b=1.0*a
print b.itemsize()
#result is 8

1) I want to pass my array to a GL routine which can only handle floats
also
2) I deal with large data sets and would prefer to keep my array  of type 
float.

Is there some to prevent the upcast? I realize Python only has double datatypes
but still .... that shouldnt prevent me from have floats in my object.

Any help?

Mathew 





More information about the NumPy-Discussion mailing list