[Numpy-discussion] Speed performance on array constant set

Mark Heslep mark at mitre.org
Thu Jan 19 20:38:00 CST 2006


Sasha wrote:

>Try a.fill(7).
>
>On my system:
>  
>
>>python -m timeit  -s "import numpy as na; a = na.zeros((1000,1000))" "a[:,:] = 7"
>>    
>>
>100 loops, best of 3: 17.1 msec per loop
>
>  
>
>>python -m timeit  -s "import numpy as na; a = na.zeros((1000,1000))" "a.fill(7)"
>>    
>>
>100 loops, best of 3: 6.28 msec per loop
>
>You can also use empty instead of zeros, but that wont affect the
>timings that you presented.
>
>-- sasha
>
>  
>
Thank you.  Any equivalent to 'fill' for NumArray or Numeric?  Well, I 
suppose its time to move to  Sci/NumPy.  Im on Fedora 4, any pointers to 
a NumPy package?  Mean time Ill pull from SVN and try again to build.  I 
have the updated gcc Fortran.

Mark




More information about the Numpy-discussion mailing list