XL Fortran for AIX 8.1

Language Reference


ANY(MASK, DIM)

Determines if any of the values in an entire array, or in each vector along a single dimension, are true.

MASK
is a logical array.

DIM (optional)
is an integer scalar in the range 1 <= DIM <= rank(MASK). The corresponding actual argument must not be an optional dummy argument.

Class

Transformational function

Result Value

The result is a logical array of the same type and type parameters as MASK, and rank of rank(MASK)-1. If the DIM is missing, or MASK has a rank of one, the result is a scalar of type logical.

The shape of the result is (s1, s2, ..., s(DIM -1), s(DIM+1), ..., sn), where n is the rank of MASK.

Each element in the result array is .TRUE. if any of the elements given by MASK(m1, m2, ..., m(DIM-1), :, m(DIM+1), ..., mn) are true. When the result is a scalar, either because DIM is not specified or because MASK is of rank one, it is .TRUE. if any of the elements of MASK are true.

Examples

! A is the array | 9 -6 7 |, and B is the array | 2 7 8 |
!                | 3 -1 5 |                     | 5 6 9 |
 
! Is any element in A greater than or equal to the
! corresponding element in B?
      RES = ANY(A .GE. B)          ! result RES is true
 
! For each column in A, is there any element in the column
! greater than or equal to the corresponding element in B?
      RES = ANY(A .GE. B, DIM = 1) ! result RES is (t,f,f)
 
! Same question, but for each row of A and B.
      RES = ANY(A .GE. B, DIM = 2) ! result RES is (t,f)


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