DCL: MATH1: Summary: FORTRAN77 Standard
Multi-dimensional arrays (of up to 7-D) can be defined in FORTRAN77. However, the actual memory system does not have a multi-dimensional structure, and it is managed one-dimensionally. The order for unfolding a multi-dimensional array into a 1-D array is defined in the FORTRAN77 standard, and so it is possible to combine multi-dimensional arrays to 1-D arrays (to give a 1-D name to multi-dimensional arrays.) For example, in the case of
REAL X(6), Y(2,3) COMPLEX Z(3) EQUIVALENCE (X,Y,Z)
the variables x, y, z all are arrays with 6 words (48 bytes), and they occupy the same memory area according to the EQUIVALENCE statement. The variables are aligned in the following order.
The 2-D array y is unfolded into a 1-D array in a way so that the
left subscript changes first. Complex number data z is unfolded as a
sequence of 2 floating-point numbers. Therefore, the value of X(3) will be
exactly the same as Y(1,2), Re(Z(2)).
This rule is actively used in many programs to treat multi-dimensional arrays
as 1-D arrays or to treat complex-number data as floating-point-number data. This rule is
close to the hardware of computers, so it may appear machine-dependent, but
this is "standard language" defined in FORTRAN77 standard.