PARITY— Reduction with exclusive OR
Calculates the parity, i.e. the reduction using
of MASK along dimension DIM.
Fortran 2008 and later
|MASK||Shall be an array of type |
|DIM||(Optional) shall be a scalar of type
The result is of the same type as MASK.
If DIM is absent, a scalar with the parity of all elements in
MASK is returned, i.e. true if an odd number of elements is
.true. and false otherwise. If DIM is present, an array
of rank n-1, where n equals the rank of ARRAY,
and a shape similar to that of MASK with dimension DIM
dropped is returned.
PROGRAM test_sum LOGICAL :: x(2) = [ .true., .false. ] print *, PARITY(x) ! prints "T" (true). END PROGRAM