On 1/23/2010 5:01 PM, Anne Archibald wrote:
> If both arrays are "C contiguous", or more generally contiguous blocks
> of memory with the same strided structure, you might get faster
> copying by flattening them first, so that it can go in a single
> memcpy().

I may misuderstand this.  Did you just mean
x.flat = y.flat
?

If so, I find that to be *much* slower.

Thanks,
Alan


x = np.random.random((1000,1000))
y = x.copy()
t0 = time.clock()
for t in range(1000): x = y.copy()
print(time.clock() - t0)
t0 = time.clock()
for t in range(1000): x[:,:] = y
print(time.clock() - t0)
t0 = time.clock()
for t in range(1000): x.flat = y.flat
print(time.clock() - t0)
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to