** Next:** Array Prefix and
**Up:** Library Procedures
** Previous:** Array Reduction Functions

These are all generalized array reduction functions in which completely general, but nonoverlapping, subsets of array elements can be combined. There is a corresponding scatter function for each of the twelve reduction operation in the language. The way the elements of the source array are associated with the elements of the result is described in this section; the method of combining their values is described in the specifications of the individual functions in Section .

These functions all have the form
XXX_SCATTER(ARRAY, BASE, INDX1, ..., INDXn, MASK)
The allowed values of `XXX` are
`ALL`,
`ANY`,
`COPY`,
`COUNT`,
`IALL`,
`IANY`,
`IPARITY`,
`MAXVAL`,
`MINVAL`,
`PARITY`,
`PRODUCT`, and
`SUM`. The number of `INDX` arguments must equal the rank of `BASE`.
Except for `COUNT_SCATTER`, `ARRAY` and `BASE` are arrays
of the same type. For `COUNT_SCATTER`, `ARRAY` is of type
logical and `BASE` is of type integer. The argument `MASK` is
logical, and the `INDX` arrays are integer. `ARRAY`, `MASK`, and all the `INDX` arrays are conformable. `MASK` is optional.
(For `ALL_SCATTER`, `ANY_SCATTER`, `COUNT_SCATTER`,and `PARITY_SCATTER`, the `ARRAY` must be logical. These functions do
not have an optional `MASK` argument. To conform with the
conventions of the F90 standard, the required `ARRAY` argument to
these functions is called `MASK` in their specifications in Section .)
The result has the same type, kind type parameter, and
shape as `BASE`.

For every element in `ARRAY` there is a corresponding element
in each of the `INDX` arrays. Let be the value of the
element of `INDX1` that is indexed by the same subscripts as
element of `ARRAY`. More generally, for each
, let be the value of the element of `INDXj`
that corresponds to element in `ARRAY`, where is the rank
of `BASE`. The integers , form a subscript
selecting an element of `BASE`: `BASE()`.

Thus the `INDX` arrays establish a mapping from all the elements of
`ARRAY` onto selected elements of `BASE`. Viewed in the other
direction, this mapping associates with each element of `BASE` a set of elements from `ARRAY`.

Because `BASE` and the result are conformable, for each element of
`BASE` there is a corresponding element of the result.

If is empty, then the element of the result corresponding to the
element of `BASE` has the same value as .

If is non-empty, then the elements of will be combined
with element to produce an element of the result. The
particular means of combining these values is described in the result
value section of the specification of the routine below. As an
example, for `SUM_SCATTER`, if the elements of are , then the element of the result corresponding to the
element of `BASE` is the result of evaluating `SUM((//))`.

Note that, since a scalar is conformable with any array, a scalar may
be used in place of an `INDX` array, in which case one hyperplane
of the result is selected. See the example below.

If the optional, final `MASK` argument is present, then only the
elements of `ARRAY` in positions for which `MASK` is true
participate in the operation. All other elements of `ARRAY` and of
the `INDX` arrays are ignored and cannot have any influence on any
element of the result.

For example, if

thenAis the array , 1, 2, 3 4, 5, 6 7, 8, 9 ,, plus 1filll -1; 1, 2, 3 4, 5, 6 7, 8, 9 ,; plus 1filll -1: 1, 2, 3 4, 5, 6 7, 8, 9 ,: plus 1filll -1.plus 1filll 1, 2, 3 4, 5, 6 7, 8, 9 ,.-50 1, 2, 3 4, 5, 6 7, 8, 9 , plus 1filll-1;Bis the array , -1, -2, -3 -4, -5, -6 -7, -8, -9 ,, plus 1filll -1; -1, -2, -3 -4, -5, -6 -7, -8, -9 ,; plus 1filll -1: -1, -2, -3 -4, -5, -6 -7, -8, -9 ,: plus 1filll -1.plus 1filll -1, -2, -3 -4, -5, -6 -7, -8, -9 ,.-50 -1, -2, -3 -4, -5, -6 -7, -8, -9 , plus 1filll-1;I1is the array , 1, 1, 1 2, 1, 1 3, 2, 1 ,, plus 1filll -1; 1, 1, 1 2, 1, 1 3, 2, 1 ,; plus 1filll -1: 1, 1, 1 2, 1, 1 3, 2, 1 ,: plus 1filll -1.plus 1filll 1, 1, 1 2, 1, 1 3, 2, 1 ,.-50 1, 1, 1 2, 1, 1 3, 2, 1 , plus 1filll-1;I2is the array , 1, 2, 3 1, 1, 2 1, 1, 1 ,, plus 1filll -1; 1, 2, 3 1, 1, 2 1, 1, 1 ,; plus 1filll -1: 1, 2, 3 1, 1, 2 1, 1, 1 ,: plus 1filll -1.plus 1filll 1, 2, 3 1, 1, 2 1, 1, 1 ,.-50 1, 2, 3 1, 1, 2 1, 1, 1 , plus 1filll-1

IfSUM_SCATTER(A, B, I1, I2)is , 14, 6, 0 8, -5, -6 0, -8, -9 ,, plus 1filll -1; 14, 6, 0 8, -5, -6 0, -8, -9 ,; plus 1filll -1: 14, 6, 0 8, -5, -6 0, -8, -9 ,: plus 1filll -1.plus 1filll 14, 6, 0 8, -5, -6 0, -8, -9 ,.-50 14, 6, 0 8, -5, -6 0, -8, -9 , plus 1filll-1;SUM_SCATTER(A, B, 2, I2)is , -1, -2, -3 30, 3, -3 -7,-8,-9 ,, plus 1filll -1; -1, -2, -3 30, 3, -3 -7,-8,-9 ,; plus 1filll -1: -1, -2, -3 30, 3, -3 -7,-8,-9 ,: plus 1filll -1.plus 1filll -1, -2, -3 30, 3, -3 -7,-8,-9 ,.-50 -1, -2, -3 30, 3, -3 -7,-8,-9 , plus 1filll-1;SUM_SCATTER(A, B, I1, 2)is , -1, 24, -3 -4, 7, -6 -7, -1, -9 ,, plus 1filll -1; -1, 24, -3 -4, 7, -6 -7, -1, -9 ,; plus 1filll -1: -1, 24, -3 -4, 7, -6 -7, -1, -9 ,: plus 1filll -1.plus 1filll -1, 24, -3 -4, 7, -6 -7, -1, -9 ,.-50 -1, 24, -3 -4, 7, -6 -7, -1, -9 , plus 1filll-1;SUM_SCATTER(A, B, 2, 2)is , -1, -2, -3 -4, 40, -6 -7, -8, -9 ,, plus 1filll -1; -1, -2, -3 -4, 40, -6 -7, -8, -9 ,; plus 1filll -1: -1, -2, -3 -4, 40, -6 -7, -8, -9 ,: plus 1filll -1.plus 1filll -1, -2, -3 -4, 40, -6 -7, -8, -9 ,.-50 -1, -2, -3 -4, 40, -6 -7, -8, -9 , plus 1filll-1.

Thu Jul 21 17:05:43 CDT 1994