Array Combining Scatter Up: Library Procedures Previous: Bit Manipulation Functions

Array Reduction Functions

HPF adds additional array reduction functions that operate in the same manner as the Fortran 90 SUM and ANY intrinsic functions. The new reduction functions are IALL, IANY, IPARITY, and PARITY, which correspond to the commutative, associative binary operations IAND, IOR, IEOR, and .NEQV. respectively.

In the specifications of these functions, the terms ``XXX reduction'' are used, where XXX is one of the binary operators above. These are defined by means of an example. The IAND reduction of all the elements of array for which the corresponding element of mask is true is the scalar integer computed in result by

result = IAND_IDENTITY_ELEMENT DO i_1 = LBOUND(array,1), UBOUND(array,1) ... DO i_n = LBOUND(array,n), UBOUND(array,n) IF ( mask(i_1,i_2,...,i_n) ) & result = IAND( result, array(i_1,i_2,...,i_n) ) END DO ... END DO

Here, is the rank of array and IAND_IDENTITY_ELEMENT is the integer which has all bits equal to one. (The interpretation of an integer as a sequence of bits is given in Section 13.5.7 of the Fortran 90 standard.) The other three reductions are similarly defined. The identity elements for IOR and IEOR are zero. The identity element for PARITY is .FALSE.
Thu Jul 21 17:05:43 CDT 1994