array-row-major-index
(array-row-major-index array &rest subscripts)
Returns the 0-based flat row-major index of the element of array at the given subscripts (one per dimension): the fold ((s0 * d1 + s1) * d2 + s2) ... over the dimension sizes. The result is a valid index for row-major-aref.