Help me choose a C++ compiler to work with Python
Fernando Perez
fperez528 at yahoo.com
Thu Sep 25 01:29:30 CEST 2003
rhmd wrote:
>
> MORE DETAIL ON MY QUESTION
> At
> any rate, there are some calculations where I need a LOT of speed,
> e.g. generating billions (with a B) of random numbers with the
> Mersenne Twister algorithm
Off the top of my head I don't know which rng RandomArray (part of Numeric)
uses, but its speed is not that bad:
In [20]: def rloop(n,m):
....: random = RA.random
....: size=10**m
....: for i in xrange(10**n):
....: _=random(size)
....:
In [21]: timing (1,rloop,1,5) # times are in cpu seconds
Out[21]: 0.12000000000000455
In [22]: timing (1,rloop,2,5)
Out[22]: 1.1999999999999957
In [23]: timing (1,rloop,3,5)
Out[23]: 12.469999999999999
The scaling is pretty linear, so for a billion terms you'd need about 2
minutes.
hth.
Cheers,
f
More information about the Python-list
mailing list