Contiguous vs Non-contiguous Memory Layout
Let us consider a 2-dimensional array, say in Python
x = numpy.random.rand(4, 3)
This array (matrix) with
m-elements will be represented in the memory as a
1-dimensional sequence of m-blocks.
The former is called
non-contiguous memory layout and the latter
contiguous memory layout.
❶
How is the 2-D array (non-contiguous layout) represented in the computer as contiguous layout ?
Depending upon the styles
(C or
Fortran),
the non-contiguous layout is transformed by the computer to contiguous layout.
❷