✦ For everyone, free.

Practical knowledge for real and everyday life

Home

7.4.4 Tensor Component Array Index Ordering

Tensor Component Array Index Ordering arranges indices to ensure accurate mathematical representation and computation in tensor algebra.

Tensor Component Array Index Ordering is the convention fixing the sequence in which a tensor's indices are listed, and correspondingly the sequence in which its component array's axes are arranged, so that a given index tuple is interpreted consistently every time the array is read or written to.


Definition and Scope

Why an Ordering Convention Is Needed

A tensor's abstract definition specifies which indices are upper and which are lower, but it does not, by itself, fix in what sequence those indices should be listed when the tensor is written as (T) with subscripts and superscripts. Index ordering supplies that missing convention, so that (T^{i}{\ jk}) and (T^{i}{\ kj}) are understood to refer to two different orderings of the same set of index slots rather than being treated as interchangeable notations for one array.

Tjki Tkji

in the absence of a stated symmetry linking the (j) and (k) slots.

Ordering Among Upper Indices, Lower Indices, and Between Them

Two related conventions must be fixed independently: the relative order of the several upper indices among themselves, the relative order of the several lower indices among themselves, and, in some notational systems, the interleaving of upper and lower indices relative to one another, all three of which the array index ordering must specify to remove ambiguity.


Structural Properties

Row-Major and Column-Major Layouts

Once the sequence of indices is fixed, a separate but related choice determines how that sequence maps onto linear memory: a row-major ordering varies the last-listed index fastest as memory address increases, while a column-major ordering varies the first-listed index fastest. For a rank-2 array with shape ((n,n)), the offset of entry ((i,j)) under a row-major layout is

offset = (i-1)n + (j-1)

while under column-major it is ((j-1)n + (i-1)), the two conventions producing different physical layouts of the identical logical array.

Consequences of a Mismatched Ordering

Combining two arrays that use different index orderings without first reconciling them produces incorrect results even when both arrays represent tensors correctly individually: an addition performed entry by entry, or a contraction performed over what is assumed to be a matched pair of indices, silently returns a meaningless array if the operands do not agree on which physical axis corresponds to which logical index.

ordering A: (i,j,k) ordering B: (k,i,j) same tensor

Permutation as a Reordering Operation

Explicitly permuting the axes of an array to switch from one index ordering to another is itself a well-defined operation, provided the permutation is tracked and applied consistently to every entry, since the underlying tensor is unaffected by the choice of ordering even though its stored representation changes completely.


Role Within Tensor Algebra

Interfacing Between Notation and Storage

Index ordering is the layer that connects the abstract, order-flexible notation of tensor algebra, where index names rather than position typically carry the meaning, to the concrete, order-dependent storage used in computation, where position in the array is all that is available at the level of raw memory.

Establishing Conventions Across a Computation

Fixing a single, consistent index ordering convention across an entire computation, and documenting it alongside any stored tensor, is what allows different routines, and different collaborators, to combine tensors correctly without each result needing to be independently re-verified against the others' storage conventions.