PARITY — Reduction with exclusive OR¶
- PARITY()¶
Calculates the parity, i.e. the reduction using
.XOR., ofMASKalong dimensionDIM.- Parameters
MASK – Shall be an array of type
LOGICALDIM – (Optional) shall be a scalar of type
INTEGERwith 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