Manual Reference Pages  - iparity (3fortran)

NAME

IPARITY(3) - [BIT:LOGICAL] Bitwise exclusive OR of array elements

SYNOPSIS

result = iparity( array [,mask] ) | iparity( array, dim [,mask] )

         integer(kind=KIND) function iparity(array, dim, mask )

integer(kind=KIND),intent(in) :: array(..) logical(kind=**),intent(in),optional :: dim logical(kind=**),intent(in),optional :: mask(..)

o ARRAY - An integer array.
o DIM - an integer scalar from 1 to the rank of ARRAY
o MASK - logical conformable with ARRAY.

DESCRIPTION

IPARITY(3) reduces with bitwise xor (exclusive or) the elements of ARRAY along dimension DIM if the corresponding element in MASK is .true..

OPTIONS

o ARRAY : an array of integer values
o DIM : a value from 1 to the rank of ARRAY.
o MASK : a logical mask either a scalar or an array of the same shape as ARRAY.

RESULT

The result is of the same type as ARRAY.

If DIM is absent, a scalar with the bitwise xor of all elements in ARRAY is returned. Otherwise, an array of rank N-1, where N equals the rank of ARRAY, and a shape similar to that of ARRAY with dimension DIM dropped is returned.

Case (i) : The result of IPARITY (ARRAY) has a value equal to the bitwise exclusive OR of all the elements of ARRAY. If ARRAY has size zero the result has the value zero.

Case (ii) : The result of IPARITY (ARRAY, MASK=MASK) has a value equal to that of

           IPARITY (PACK (ARRAY, MASK)).

Case (iii) : The result of IPARITY (ARRAY, DIM=DIM [, MASK=MASK]) has a value equal to that of IPARITY (ARRAY [, MASK=MASK]) if ARRAY has rank one.

    Otherwise, an array of values reduced along the dimension
    DIM is returned.

EXAMPLES

Sample program:

    program demo_iparity
    implicit none
    integer, dimension(2) :: a
      a(1) = int(b’00100100’)
      a(2) = int(b’01101010’)
      print ’(b8.8)’, iparity(a)
    end program demo_iparity

Results:

     > 01001110

STANDARD

Fortran 2008

SEE ALSO

IANY(3), IALL(3), IEOR(3), PARITY(3)

Fortran intrinsic descriptions


Nemo Release 3.1 iparity (3fortran) November 02, 2024
Generated by manServer 1.08 from cfd7995a-c021-41b5-8170-42c6c15c70a3 using man macros.