all

Date:

10-12-2011

NAME

ALL - Determines whether all values are true

SYNOPSIS

ALL ([MASK=]mask [,[DIM=]dim])

STANDARDS

Fortran

DESCRIPTION

The ALL intrinsic function determines whether all values are true in mask along dimension dim. It accepts the following arguments:

mask

Must be of type logical. It must not be a scalar.

dim

Must be a scalar. It must be an integer value in the range 1 <= dim <= n, where n is the rank of mask. The corresponding actual argument must not be an optional dummy argument.

ALL is a transformational function. The name of this intrinsic cannot be passed as an argument.

RETURN VALUES

The result type is type logical with the same kind type parameter as MASK. It is a scalar result if dim is absent or if mask has rank one. Otherwise, the result is an array of rank n-1 and of shape

(d1, d2, ..., ddim-1, ddim+1, ..., dn)

where

(d1, d2, ..., dn)

is the shape of mask.

The result of ALL(mask) has the value TRUE if all the elements of mask are TRUE or if mask is a zero-sized array. The result has the value FALSE if any element of mask is FALSE.

If mask has rank one, ALL(mask, dim) has a value equal to that of ALL(mask). Otherwise, the value of element

(s1, s2, ..., sdim-1, sdim+1, ..., sn)

of ALL(mask, dim) is equal to

ALL(mask (s1, s2, ..., sdim-1, : ,sdim+1, ..., sn)  )

EXAMPLES

Example 1: ALL((/.TRUE.,.FALSE.,.TRUE./)) yields .FALSE..

Example 2: ALL(array) yields .TRUE. when array is a zero-sized array.

Example 3: Assume that B and C are arrays.

B is the following array:

| 1 3 5 |
| 2 4 6 |

C is the following array:

| 0 3 5 |
| 7 4 8 |
  • ALL(B.NE.C) yields .FALSE.

  • ALL(B.NE.C,DIM=1) yields [.TRUE.,.FALSE.,.FALSE.]

  • ALL(B.NE.C,DIM=2) yields [.FALSE.,.FALSE.]

  • ALL(B.NE.1) yields .FALSE., because there is one false element in the mask

Example 4: Assume that array N is as follows:

| 0 1 2 3 |
| 4 5 6 7 |
| 8 9 0 1 |

In an array section reference, you can expect the following results:

  • ALL((N(2:3,2:4).NE.0)) yields .FALSE.

  • ALL((N(2:3,2:4).NE.0),DIM=1) yields [.TRUE.,.FALSE.,.TRUE.]

  • ALL((N(2:3,2:4).NE.0),DIM=2) yields [.TRUE.,.FALSE.]