next up previous

4.1 Array Operations     continued...

An array expression of any dimension may appear in an array constructor. For example, if is a 10001000 array then
is an array constructor of one million elements, each having a value of 1.3 more than the corresponding element value of . The elements of 1.3 are placed in the array constructor in the familiar Fortran ``column-major" order, that is column by column by running down the first dimension and then the second. Thus (/ A+1.3 /) is equivalent to
Implied-do constructs may be used for a different order. For example, if a row by row vector of elements of 1.3 is desired, rather than column by column, the following array constructor would do the job:

Finally, a simple form of the RESHAPE intrinsic function can be used to reshape the (one-dimensional) result of an array constructor into the desired shape. The form that this takes is

RESHAPE (array-constructor, shape-vector)
where the shape-vector has one element for each dimension of the desired array shape, and the value of each shape-vector element is the number of elements in that dimension in the target array. For example, a 10001000 identity matrix of type real can be specified as the constant named Ident_1000 by the declaration
real, parameter :: Ident_1000 =                                              &

Thus the array constructor, coupled with the RESHAPE intrinsic, is an extremely powerful tool for constructing array values, including array constants.