A vector subscript is a rank-one array of integer values (within
the declared bounds for the dimension). It is used to select a
sequence of elements from a parent array. The sequence does not
have to be in order, and it can contain duplicate values.
For example, A is a rank-two array of shape (4,6). B and C are
rank-one arrays of shape (2) and (3), respectively, with the
following values:
B = (/1,4/)
C = (/2,1,1/) ! Will result in a many-one
! array section
Array section A(3,B) consists of elements A(3,1) and A(3,4). Array
section A(C,1) consists of elements A(2,1), A(1,1), and A(1,1).
Array section A(B,C) consists of the following elements:
A(1,2) A(1,1) A(1,1)
A(4,2) A(4,1) A(4,1)
An array section with a vector subscript that has two or more
elements with the same value is called a many-one array section. A
many-one section must not appear on the left of the equals sign in
an assignment statement, or as an input item in a READ statement.
The following assignments to C also show examples of vector
subscripts:
INTEGER A(2), B(2), C(2)
...
B = (/1,2/)
C(B) = A(B)
C = A((/1,2/))
An array section with a vector subscript must not be any of the
following:
o An internal file
o An actual argument associated with a dummy array that is
defined or redefined (if the INTENT attribute is specified, it
must be INTENT(IN))
o The target in a pointer assignment statement
If the sequence specified by the vector subscript is empty, the
array section has a size of zero.