In the "Copy on demand" discussion, the differences between ravel and flat were discussed with regards to contiguous/non-contiguous arrays. I want to experiment, but after looking/researching I can't figure it out: How is a non-contiguous array created?
Norman Davis Space Data Corporation
Norman Davis wrote:
How is a non-contiguous array created?
By slicing an array. Since slicing created a "view" into the same data, it may not represent a contiguous portion of memory. Example:
from Numeric import * a = ones((3,4)) a
array([[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]])
1 # a newly created array will always be contiguous
b = a[3:3,:] b.iscontiguous()
1 # sliced this way, you get a contiguous array
c = a[:,3:3] c.iscontiguous()
0 #but sliced another way you don't