XL Fortran for AIX 8.1

Language Reference


MINVAL(ARRAY, DIM, MASK) or MINVAL(ARRAY, MASK)

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

ARRAY
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.

Class

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 minimum 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 minimum value of all applicable elements.

If ARRAY is zero-sized or the mask array has all .FALSE. values, the result value is the positive 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------------------------------+

Examples

! A is the array  | -41  33 25 |
!                 |  12 -61 11 |
 
! What is the smallest element in A?
       RES = MINVAL(A)
! The result is -61
 
! What is the smallest element in each column of A?
       RES = MINVAL(A, DIM=1)
! The result is | -41 -61 11 |
 
! What is the smallest element in each row of A?
       RES = MINVAL(A, DIM=2)
! The result is | -41 -61 |
 
! What is the smallest element in each row of A,
! considering only those elements that are
! greater than zero?
       RES = MINVAL(A, DIM=2, MASK = A .GT.0)
! The result is | 25 11 |


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