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 inquiries are:
In what ways are arrays continuous and noncontiguous? Is it comparable to the C contiguous memory block? A contiguous memory block is what?
Do these two perform differently from one another? When should we use each option separately?
Why is the array no longer contiguous after transposition?
Why does c.shape = (20) return an error for a non-contiguous array with an incompatible shape?
Thanks for your answer!