XL Fortran for AIX 8.1

Language Reference


Returns the maximum value of the elements in the array along a dimension corresponding to the true elements of MASK.

is an array of type integer or real.

DIM (optional)
is an integer scalar in the range 1 <= DIM <= rank(ARRAY).

MASK (optional)
is an array or scalar of type logical that conforms to ARRAY in shape. If it is absent, the entire array is evaluated.


Transformational function

Result Value

The result is an array of rank rank(ARRAY)-1, with the same data type as ARRAY. If DIM is missing or if ARRAY is of rank one, the result is a scalar.

If DIM is specified, each element of the result value contains the maximum value of all the elements that satisfy the condition specified by MASK along each vector of the dimension DIM. The array element subscripts in the result are (s1, s2, ..., s(DIM-1), s(DIM+1), ..., sn), where n is the rank of ARRAY and DIM is the dimension specified by DIM.

If DIM is not specified, the function returns the maximum value of all applicable elements.

If ARRAY is zero-sized or the mask array has all .FALSE. values, the result value is the negative number of the largest magnitude, of the same type and kind type as ARRAY.

+---------------------------------Fortran 95---------------------------------+

Because both DIM and MASK are optional, various combinations of arguments are possible. When the -qintlog option is specified with two arguments, the second argument refers to one of the following:

+-----------------------------End of Fortran 95------------------------------+


! A is the array  | -41  33 25 |
!                 |  12 -61 11 |
! What is the largest value in the entire array?
       RES = MAXVAL(A)
! The result is 33
! What is the largest value in each column?
       RES = MAXVAL(A, DIM=1)
! The result is | 12 33 25 |
! What is the largest value in each row?
       RES = MAXVAL(A, DIM=2)
! The result is | 33 12 |
! What is the largest value in each row, considering only
! elements that are less than 30?
       RES = MAXVAL(A, DIM=2, MASK = A .LT. 30)
! The result is | 25 12 |

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]