Optional Arguments. `DIM`, `MASK`

Description. Determine the locations of the first elements of `ARRAY` along dimension `DIM` having the maximum value of the
elements identified by `MASK`.

Class. Transformational function.

Arguments.

ARRAY must be of type integer or real. It must not be scalar.

DIM (optional) must be scalar and of type integer with
a value in
the range , where is the rank of `ARRAY`. The corresponding actual
argument must not be an optional dummy
argument.

MASK (optional) must be of type logical and must be
conformable
with `ARRAY`.

Result Type, Type Parameter, and Shape. The result is of type
default integer.
If `DIM` is absent the result is an array of
rank one and size equal to the rank of `ARRAY`; otherwise, the
result is an array of rank and shape , where
is the shape of `ARRAY`.

Result Value.

(i): The result of executing `S = MAXLOC(ARRAY) +
LBOUND(ARRAY) - 1`
is a rank-one array `S` of size equal to the rank
of `ARRAY`. It is such that `ARRAY(S(1), ..., S(n))` has the maximum value of all of
the elements of `ARRAY`. If more than one element
has the maximum value, the element whose subscripts are
returned is the first such element, taken in array
element order. If `ARRAY` has size zero, the
result is implementation dependent.

(ii): The result of executing `S = MAXLOC(ARRAY, MASK) +
LBOUND(ARRAY) - 1` is a rank-one array `S` of size
equal to the rank of `ARRAY`. It is such
that `ARRAY(S(1), ..., S(n))` corresponds to a true
element of `MASK`, and has the maximum value of all
such elements of `ARRAY`. If more than one element
has the maximum value, the element whose subscripts are
returned is the first such element, taken in array
element order. If there are no such elements (that is,
if `ARRAY` has size zero or every element of `MASK` has the value false), the result is implementation
dependent.

(iii): If `ARRAY` has rank one, the result of `MAXLOC(ARRAY, DIM` [`,MASK`]`)` is a scalar `S` such
that `ARRAY(S + LBOUND(ARRAY,1) - 1)` corresponds
to a true element of `MASK` (if `MASK` is
present) and has the maximum value of all such elements
(all elements if `MASK` is absent). It is the
smallest such subscript.
Otherwise, the value of element
of
`MAXLOC(ARRAY, DIM` [`,MASK`]`)` is equal to
`MAXLOC(ARRAY()`
[`,MASK = MASK()`]`)`.

Examples.

(i): The value of `MAXLOC((/ 5, -9, 3 /))` is ,1,, plus 1filll
-1;1,; plus 1filll
-1:1,: plus 1filll
-1.1,. plus 1filll
-11, plus 1filll-1.

(ii): `MAXLOC(C, MASK = C .LT. 0)` finds the location of the first
element of `C` that is the maximum of the negative
elements.

(iii): The value of `MAXLOC((/ 5, -9, 3 /), DIM=1)` is 1.
If `B` is the array , 1, 3, -9 2, 2, 6 ,, plus 1filll
-1; 1, 3, -9 2, 2, 6 ,; plus 1filll
-1: 1, 3, -9 2, 2, 6 ,: plus 1filll
-1.plus 1filll
1, 3, -9 2, 2, 6 ,.-50 1, 3, -9 2, 2, 6 , plus 1filll-1,
`MAXLOC( B, DIM = 1 )` is , 2, 1, 2 ,, plus 1filll
-1; 2, 1, 2 ,; plus 1filll
-1: 2, 1, 2 ,: plus 1filll
-1. 2, 1, 2 ,. plus 1filll
-1 2, 1, 2 , plus 1filll-1 and
`MAXLOC( B, DIM = 2 )` is , 2, 3 ,, plus 1filll
-1; 2, 3 ,; plus 1filll
-1: 2, 3 ,: plus 1filll
-1. 2, 3 ,. plus 1filll
-1 2, 3 , plus 1filll-1. Note that this is true
even if `B` has a declared lower bound other than
1.

Thu Dec 8 16:17:11 CST 1994