wiki:RasdamanInternalArrayRepresentation

Version 1 (modified by dmisev, 2 months ago) (diff)

--

Internal array representation in rasdaman

Internally in rasdaman, multidimensional arrays are handled as a 1-D array, linearized in row-major format. Row-major refers to matrices with rows and columns, indicating that first all cells of the first row are listed in order, then all cells of the second row, etc. Given that we are working with multidimensional arrays here, this notion needs to be generalized: the inner-most (last) axis is contiguous, and varies fastest, followed by the second last axis and so on.

For example, let's say we have an array with sdom [5:10, -2:2, 0:5]. The 1-D internal_array (in code) corresponds to external_array (in rasql):

linear_index := 0
for i := 5..10
  for j := -2..2
    for k := 0..5
      internal_array[linear_index] == external_array[i, j, k]
      linear_index += 1