9.3.12 ANY (MASK [,DIM])

Description:  Determines if any value is true in an entire array or in a specified dimension of an array. 
Class:  Transformational function; Generic 
Arguments:  MASK Must be a logical array. 
  DIM (opt) Must be a scalar integer expression with a value in the range 1 to n, where n is the rank of MASK.  
Results:  The result is an array or a scalar of type logical.

The result is a scalar if DIM is omitted or MASK has rank one. A scalar result is true if any elements of MASK are true. The result has the value false if no element of MASK is true, or MASK has size zero.

An array result has the same type and kind parameters as MASK, and a rank that is one less than MASK. Its shape is (d1, d2, ..., dDIM-1, dDIM+1, ..., dn), where (d1, d2, ..., dn) is the shape of MASK.

Each element in an array result is true if any elements in the one dimensional array defined by MASK (s1, s2, ..., sDIM-1, :, sDIM+1, ..., sn) are true.

Examples

ANY ((/.FALSE., .FALSE., .TRUE./)) has the value true because one element is true.

A is the array

  [ 1  5  7 ]
  [ 3  6  8 ]
and B is the array
  [ 0  5  7 ]
  [ 2  6  9 ].

ANY (A .EQ. B, DIM=1) tests to see if any elements in each column of A are equal to the elements in the corresponding column of B. The result has the value (false, true, true) because the second and third columns have at least one element that is equal.

ANY (A .EQ. B, DIM=2) tests to see if any elements in each row of A are equal to the elements in the corresponding row of B. The result has the value (true, true) because each row has at least one element that is equal.


Previous Page Next Page Table of Contents