Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

IPARITY

Transformational Intrinsic Function (Generic): Returns the result of a bitwise exclusive OR operation.

result = IPARITY (array, dim [, mask])

result = IPARITY (array [, mask])

array

(Input) Must be an array of type integer.

dim

(Input) Must be a scalar integer with a value in the range 1 <= dim <= n, where n is the rank of array.

mask

(Input; optional) Must be of type logical and conformable with array.

Results

The result has the same type and kind parameters as array. It is scalar if dim does not appear; otherwise, the result has rank n - 1 and shape [d1, d2, ..., ddim-1, ddim+1 , ..., dn] where [d1, d2,..., dn] is the shape of array.

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 value is equal to zero.

The result of IPARITY (array, MASK=mask) has a value equal to IPARITY (PACK (array, mask)).

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, the value of element (s1, s2, ..., sdim-1, sdim+1 , ..., sn) of the result is equal to IPARITY (array (s1, s2, ..., sdim-1 , :, sdim+1 , ..., sn) [, MASK = mask (s1, s2, ..., sdim-1 , :, sdim+1 , ..., sn)]).

Example

IPARITY ([14, 13, 8]) has the value 11. IPARITY ([14, 13, 8], MASK=[.true., .false., .true]) has the value 6.

See Also