PARITY — Reduction with exclusive OR#
-
PARITY(MASK, DIM)#
Calculates the parity, i.e. the reduction using
.XOR.
, ofMASK
along dimensionDIM
.- Parameters
MASK – Shall be an array of type
LOGICAL
DIM – (Optional) shall be a scalar of type
INTEGER
with a value in the range from 1 to n, where n equals the rank ofMASK
.
- Returns
The result is of the same type as
MASK
.
- Standard:
Fortran 2008 and later
- Class:
Transformational function
- Syntax:
RESULT = PARITY(MASK[, DIM])
- Example:
PROGRAM test_sum LOGICAL :: x(2) = [ .true., .false. ] print *, PARITY(x) ! prints "T" (true). END PROGRAM