ANY(MASK, DIM)

Purpose

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

Class

Transformational function

Argument type and attributes

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.

Result value

The result is a logical array of the same type parameters as MASK. The rank of the result is rank(MASK)-1 if the DIM is specified; otherwise 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)