In several places in the DIRSIG inputs or outputs, a multi-dimensional array will be "packed" into a 1D array, string, etc. for storage.

2D Array Packing

There are numerous places where a 2D array or matrix is used in DIRSIG. These include:

  • 3D affine transforms (a 4x4 matrix) are used:

    • In the platform model to describe "attachments" (both instrument and mount attachments) and dynamic mount transforms.

    • In the ODB and GLIST to describe the location and orientation of object instances.

  • Mueller Matrix data

Since there are two dimensions of the data, the data can be "unrolled" in two different orders: row-major and column-major.

Row Major

Consider the following 4x4 matrix:

  m00 m01 m02 m03
  m10 m11 m12 m13
  m20 m21 m22 m23
  m30 m31 m32 m33

The sixteen (16) elements in this 2D matrix can be packed into a 1D array using row-major order as:

 m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33

Column Major

Consider the following 4x4 matrix:

  m00 m01 m02 m03
  m10 m11 m12 m13
  m20 m21 m22 m23
  m30 m31 m32 m33

The sixteen (16) elements in this 2D matrix can be packed into a 1D array using column-major order as:

 m00 m10 m20 m30 m01 m11 m21 m31 m02 m12 m22 m32 m03 m13 m23 m33