HP Fortran Programmer's Reference (September 2007)

Intrinsic procedures
Intrinsic procedure specifications
Chapter 11590
Result value
Case 1 If MASK is absent, the result is a rank-one array whose element values are
the values of the subscripts of an element of ARRAY whose value equals the
maximum value of all of the elements of ARRAY.
The
i
th subscript returned lies in the range 1 to
e
i
, where
e
i
is the extent of
the
i
th dimension 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 value of the result is processor-dependent.
Case 2 If MASK is present, the result is a rank-one array whose element values are
the values of the subscripts of an element of ARRAY, corresponding to a
.TRUE. element of MASK, whose value equals the maximum value of all such
elements of ARRAY.
The
i
th subscript returned lies in the range 1 to
e
i
, where
e
i
is the extent of
the
i
th dimension of ARRAY.
If more than one such 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 value of the result is
processor-dependent.
In both cases, an element of the result is undefined if the processor cannot represent the value
as a default integer.
MAXVAL(ARRAY, DIM, MASK)
Optional arguments
DIM, MASK
Description
Maximum value of the elements of ARRAY along dimension DIM that correspond to the .TRUE.
elements of MASK.
Class
Transformational function.