Call Us: US - +1 845 478 5244 | UK - +44 20 7193 7850 | AUS - +61 2 8005 4826

Array (used for homogeneous

Fundamental Data Structures
There are four fundamental data structures that may be used for archiving data in the PDS. All
products delivered to the PDS must be constructed from one or more of these structures. These
four fundamental structures are described using four base classes: Array (used for homogeneous
N-dimensional arrays of scalars), Table_Base (used for repeating records of heterogeneous
scalars), Parsable_Byte_Stream (a stream of bytes that can be parsed using standardized rules),
and Encoded_Byte_Stream (an encoded stream of bytes). All other digital object classes in the
PDS are derived from one of these four base classes.
4A Array
The first of the four basic PDS4 structures is the Array. Any data structure that consists of fixedlength rows of homogeneous elements in any number of dimensions must be described using the
Array class or one of its subclasses. As two- and three-dimensional (2-D and 3-D, respectively)
arrays are among the most commonly used data structures in science, the discussion below will
focus on them.
4A.1 Storage Order and Index Order – Definitions
The location of a particular element in a 2-D array is specified using its row number (first index)
and column number (second index) when using standard matrix notation. Thus, in the array
shown below, the position of the “2” (row 1, column 2) is specified using the notation (1,2),
while the position of the “4” (row 2, column 1) is specified as (2,1).
An N-dimensional array is always stored in computer memory or in a data file as a linear
sequence of numbers. There are two ways to store 2-D array data in linear memory: row-major
order and column-major order. In row-major storage, the rows of the array are stored
sequentially. In column-major storage, the columns are stored sequentially.
Thus, using the above notation, a row-major 2×3 array would be stored this way in memory:
(1,1), (1,2), (1,3), (2,1), (2,2), (2,3)
or, using the numbers in the example above, the values would be stored as follows:
1 2 3 4 5 6
PDS Standards Reference 1.11.0 2018-10-01 22
The same array, in column-major order, would be stored this way:
(1,1), (2,1), (1,2), (2,2), (1,3), (2,3)
1 4 2 5 3 6
PDS uses the terminology Last_Index_Fastest as a synonym for 2-D row-major order and
First_Index_Fastest as a synonym for 2-D column-major order. The PDS terms generalize
immediately to N-dimensional arrays whereas the meanings of “row” and “column” become
ambiguous. In an N-dimensional array with Last_Index_Fastest, the next to last index varies
next to fastest and the first index varies slowest.
Last_Index_Fastest (row-major) is the required storage order for PDS4 array data. Note that this
does not require modifying data already stored in First_Index_Fastest (column-major) order;
only the order in which the axes are defined in the label needs to be switched. See the discussion
below under Axis Meaning for more information. For example, the PDS4 label for a twodimensional array stored in First_Index_Fastest order should define the row axis first and the
column axis second. The PDS4 label for an array stored in Last_Index_Fastest order should
define the column axis first and the row axis second.