If an object or sub-object is used directly in an expression then it must conform with all other objects in that expression. (Note that a scalar conforms to any array with the same value for every element.) for two array references to conform both objects must be the same shape.
Using the declarations from before:
C = D ! is valid A = B ! is not valid
Visualisation,
Figure 9: Visualisation of conforming Arrays
A and B have the same size (15 elements) but have different shapes so cannot be directly equated. To force conformance the array must be used as an argument to a transformational intrinsic to change its shape, for example,
B = RESHAPE(A,(/5,3/)) ! is, see later A = PACK(B,.TRUE.) ! is, see later A = RESHAPE(B,(/10,8/)) ! is, see later B = PACK(A,.TRUE.) ! is, see later
Arrays can have their shapes changed by using transformational intrinsics including, MERGE, PACK, SPREAD, UNPACK and RESHAPE.
Two arrays of different types conform and if used in the same expression will have the relevant type coercion performed just like scalars.
Return to corresponding overview page