## C-style transformation of non-contiguous to contiguous layout Let us consider a 2-D array, `x = numpy.random.rand(4,3)`. The shape of the array is therefore 4 × 3 array ( `numpy.shape(x) = (4,3)`). Also any element in the array is associated with its respective, index (n0, n1).

Then, for a C-style non-contiguous layout with shape, (d0, d1, …, dN−1), the value associated with (n0, n1, …, nN−1) is located in the contiguous layout with index = nC.

If,

ni ≜ value of ith index in the non-contiguous layout.
eg. for (2, 1) entry in x is (n0 = 2, n1 = 1)

For C-style non-contiguous layout with shape (d0, d1, …, dN−1) the value in (n0, n1, …, nN−1) is located in the contiguous layout with index nC such that, for dk, dk + 1, …, dm−1, dm if k > m ## Examples illustrating transformation to contiguous layout in C-style

Eg.1: Location of element in x with index (2, 1)

For a C-style non-contiguous layout x with shape, (d0 = 4, d1 = 3) i.e. (d0, d2−1) ∴ N = 2, the value in (n0 = 2, n1 = 1) of the non-contiguous layout is located in the contiguous layout with index nC given by,  Eg.2: Location of element in x with index (3, 1)

For a C-style non-contiguous layout x with shape, (d0 = 4, d1 = 3) the value in (n0 = 3, n1 = 1) of the non-contiguous layout is located in the contiguous layout with index nCgiven by, Notice that to move from the element with index (2, 1) in the array x to the element at (3, 1), three elements within the array must be jumped.

### Stride in an array

The number of elements that must be jumped to get to the next element (eg. next arrow) is given by the stride.

Stride in N-dimensional C-style array where
Stride is 