インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

ALL

Transformational Intrinsic Function (Generic): Determines if all values are true in an entire array or in a specified dimension of an array.

result = ALL (mask [,dim])

mask

(Input) Must be a logical array.

dim

(Input; optional) Must be a scalar integer 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 only if all elements of mask are true, or mask has size zero. The result has the value false if any element of mask is false.

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 only if all elements in the one dimensional array defined by mask(s1, s2, ..., sdim-1, :, sdim+1, ..., sn) are true.

Example

        LOGICAL mask( 2, 3), AR1(3), AR2(2)
        mask = RESHAPE((/.TRUE., .TRUE., .FALSE., .TRUE., .FALSE., &
                        .FALSE./),(/2,3/))
! mask is true false false
! true true false 
       AR1 = ALL(mask,DIM = 1) ! evaluates the elements column by
                ! column yielding [true false false]
       AR2 = ALL(mask,DIM = 2) ! evaluates the elements row by row
                ! yielding [false false].

ALL ((/.TRUE., .FALSE., .TRUE./)) has the value false because some elements of MASK are not true.

ALL ((/.TRUE., .TRUE., .TRUE./)) has the value true because all elements of MASK are true.

A is the array

    [ 1  5  7 ]
    [ 3  6  8 ]

and B is the array

    [ 0  5  7 ]
    [ 2  6  9 ].

ALL (A .EQ. B, DIM=1) tests to see if all elements in each column of A are equal to the elements in the corresponding column of B. The result has the value (false, true, false) because only the second column has elements that are all equal.

ALL (A .EQ. B, DIM=2) tests to see if all elements in each row of A are equal to the elements in the corresponding row of B. The result has the value (false, false) because each row has some elements that are not equal.

See Also