ABSTRACT

A Fortran array is a set of scalar elements ordered in up to seven dimensions, forming what can be visualized as a hyper-rectangular array. Nevertheless, in a sense any array may be regarded as a continuous linear sequence of elements. Within the processor’s memory, an array of any rank will usually be stored in an uninterrupted sequence of memory locations. Moreover, a statement such as

WRITE ( * , * ) table where table is an array of any shape, will output a series of values depending on the size, but not the detailed shape, of the array table. In Fortran, all the elements of an array form a sequence in what is known as “array element order”, which was mentioned briefly when the PACK function was discussed in Section 5.7. In the trivial case of a rank-one array, this is simply the order of increasing subscript, i.e. the array q(–3:3) gives the sequence

q(–3), q(–2), q(–1), q(0), q(1), q(2), q(3) For a rank-two array, the array element order is given by letting the first subscript run repeatedly, i.e. the array q(2, 3) gives the sequence

q(1, 1), q(2, 1), q(1, 2), q(2, 2), q(1, 3), q(2, 3) In general, whatever the rank, “array element order” is given by letting earlier subscripts vary more often than later ones.