What is the difference between contiguous and non-contiguous arrays?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In the numpy manual about the reshape() function, it says >>> a = np.zeros((10, 2)) # A transpose make the array non-contiguous >>> b = a.T # Taking a view makes it possible to modify the shape without modifying the # initial object. >>> c = b.view() >>> c.shape = (20) AttributeError: incompatible shape for a non-contiguous array My questions are: What are continuous and noncontiguous arrays? Is it similar to the contiguous memory block in C like What is a contiguous memory block? Is there any performance difference between these two? When