 |
» |
|
|
 |
A Fortran 90 array is
a single, named entity consisting of a set of objects called array elements,
all of the same type and type parameters, arranged in a rectangular
pattern of one or more dimensions. An array is therefore said to
have the DIMENSION
attribute, and arrays in Fortran 90 may have up to seven
dimensions. An array has the following properties: - rank
The
number of dimensions of the array. This is fixed for a given array,
and is determined from the array declaration. If an object is not
an array, then it is said to be scalar
and to have rank zero. - lower bound, upper bound,
extent
Each
array dimension has a lower bound, an
upper bound, and an extent
that is defined as MAX (upper bound -lower bound + 1, 0) Bounds
are integer valued and may be positive, zero, or negative. Unlike
FORTRAN 77, it is permissible for the lower
bound to be greater than the upper bound;
if this happens then there are no elements in the dimension and
the extent of the dimension is defined to be zero. - size
The size of
an array is the total number of array elements, computed as the
product of all its extents. If the extent of any dimension is zero,
the size of the array is zero and the array contains no elements.
An array with no elements is known as a zero-sized array. - shape
The
shape of an array is a vector of the
extents of each dimension of the array; the shape can thus be expressed
as a one-dimensional array of size equal to the rank of the array
being described. For example, if given the following declarations: The rank of a1
is 1 as it only has one dimension, the extent of the single dimension
is 10, and the size of a1
is also 10. a1
has a shape represented by the vector [ 10 ]. a2 has
been declared with two dimensions and consequently has a rank of
2, the extents of the dimensions are 2 and 4 respectively, and the
size of a2 is
8. The vector [ 2, 4 ] represents the array's shape. a3 has
a rank of 3, the extent of the first two dimensions is 5, and the
extent of the third dimension is zero. The size of a3
is the product of all the extents and is therefore zero. The shape
of a3 is [ 5,
5, 0] s1 is a
scalar and therefore has a rank of zero, and its shape is represented
by an empty vector.
|