[Numpy-discussion] switching to float32

Geoffrey Ely gely@usc....
Thu Jun 25 10:40:47 CDT 2009


This does not exactly answer your question, but you can use the dtype  
string representation and positional parameter to make things nicer.  
For example:

a = numpy.array( [1.0, 2.0, 3.0], 'f' )

instead of

a = numpy.array( [1.0, 2.0, 3.0], dtype=numpy.float32 )

-Geoff

On Jun 25, 2009, at 6:43 AM, John Schulman wrote:

> I'm trying to reduce the memory used in a calculation, so I'd like to
> switch my program to float32 instead of float64. Is it possible to
> change the numpy default float size, so I don't have to explicitly
> state dtype=np.float32 everywhere?
>
> Thanks,
> John
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the Numpy-discussion mailing list