Steven Bethard wrote:
> As mentioned, this has nothing to do with numarray, and everything to > do with your inexplicable use of lists. Why don't you just write this > as: > > arr = numarray.ones((8, 8, 256, 256), Float64)
The code I posted was simplified from a larger program which I have now revised. But I still ask: why did it take 4.3 seconds to run?
And I repeat, because you were using lists, not numarray. ;) If you want a numarray array, create it directly, don't create it from lists.
What's your real code look like? Are you sure you need two nested loops? If you're sure, can you do something like
import numarray as na
arr = na.zeros((8, 8, 256, 256))
for i in xrange(8):
for j in xrange(8):
arr[i,j] = na.ones((256, 256))
where you allocate the array first and then fill it?
STeVe -- http://mail.python.org/mailman/listinfo/python-list