[Numpy-discussion] Specifying a dtype with RandomState?
Wed Dec 24 16:11:13 CST 2008
I'm generating rather large matrices with a fixed random seed using
rs = N.random.RandomState(123456789)
U = rs.uniform(low=-0.1 high=self.0.1 size=(480189, 1000)).astype('float32')
Several other arrays are instantiated as well.
Because they are so large, I do all calculations on single-precision arrays.
Coercing the output of rs.uniform() into a float32 requires an enormous copy
operation (if I understand right). Since I am already hitting the upper
limit of the memory space I have, it would be convenient if I could avoid
the astype('float32') operation.
Is there a way to have a RandomState object output single-precision floats?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion