HPF adds additional array reduction functions that operate in the same manner as the Fortran 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, n 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 F95:13.5.7.) The other three reductions are similarly defined. The identity elements for IOR and IEOR are zero. The identity element for .NEQV. is .FALSE.