[UP]


Manual Reference Pages  - parity (3)

NAME

parity(3f) - [FORTRAN:INTRINSIC:TRANSFORMATIONAL FUNCTION] Reduction with exclusive OR()

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class

SYNTAX

result = parity(mask[, dim])

DESCRIPTION

Calculates the parity (i.e. the reduction using .xor.) of MASK along dimension DIM.

ARGUMENTS

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 of ARRAY.

RETURN VALUE

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: .true. if an odd number of elements are .true. and where "n" equals the rank of MASK, and a shape similar to that of MASK with dimension DIM dropped is returned.

EXAMPLE

Sample program:

   program demo_parity
     logical :: x(2) = [ .true., .false. ]
     print *, parity(x) ! T
   end program demo_parity

STANDARD

[[Fortran 2008]] and later

CLASS

Transformational function


parity (3) March 18, 2019
Generated by manServer 1.08 from 7a8b0e04-6515-4bd9-990f-f8d9ec078ce5 using man macros.