Intel® Fortran Compiler 16.0 User and Reference Guide

PARITY

Transformational Intrinsic Function (Generic): Reduces an array by using an exclusive OR (.NEQV.) operation.

result = PARITY (mask[, dim])

mask

(Input) Must be an array of type logical.

dim

(Input; optional) Must be a scalar integer with a 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.

Results

The result has the same type and kind parameters as mask. It is scalar if dim does not appear; otherwise, the result has rank n - 1 and shape [d1, d2, ..., ddim-1, ddim+1 , ..., dn] where [d1, d2,..., dn] is the shape of mask.

The result of PARITY(mask) has the value .TRUE. if an odd number of the elements of mask are true; otherwise, .FALSE..

If mask has rank one, PARITY(mask, dim) is equal to PARITY(mask). Otherwise, the value of element (s1, s2, ..., sdim-1, sdim+1 , ..., sn) of PARITY(mask, dim) is equal to PARITY (mask (s1, s2, ..., sdim-1 , :, sdim+1 , ..., sn)).

Example

If A is the array

  [ T  F  T ]
  [ T  T  F ]

and T has the value .TRUE. and F has the value .FALSE., then

PARITY (A, DIM=1) has the value [F, T, T] and PARITY (A, DIM=2) has the value [F, F].