Reduction operations take one or more distributed arrays as input. They combine the elements to produce one or more scalar values, or arrays of lower rank. Adlib provides a fairly large set of reduction operations, mimicking the reductions available as ``intrinsic functions'' in Fortran.

As a first example, the `maxval` operation simply returns the
maximum of all elements of an array. It has prototypes

where now runs over all Java

behave in a similar way:

The function `dotProduct` used in some earlier examples is also
logically a reduction, but it takes two
aligned arrays as arguments and returns
their scalar product--the sum of pairwise products of elements.
The situation with element types is complicated
because the types of the two arguments needn't be identical.
If they are different, standard Java binary numeric promotions are
applied before multiplying elements. The prototype is

If either of or is a floating point type (

This returns the logical ``or'' of all the pairwise logical ``ands'' of elements.

The methods `maxloc` and `minloc` return respectively the maximum
and minimum values of all elements of an array--similar to `maxval`
and `minval`--but also output the index tuple in the array at
which the extreme value was found. The prototypical forms are:

where

For each of the simple reductions that combine all elements of an array
into a single value, there is a corresponding ``dimensional reduction'',
which just reduces along a selected dimension of the input array, and
outputs an array of values of rank one less than the input.
The method `maxvalDim()`, for example, has the form:

The

for , and

for . The reductions

where the array

Finally all the numeric simple reductions and dimensional reductions
all have ``masked'' variants. These take an extra boolean array
aligned with the source array. For example

ignores all elements of

A notable omission in the current version of the library is any facility for user-defined reduction operations. It also omits various arithmetic reductions that might seem natural in Java, such as bitwise, and, or, and xor. There is no fundamental reason for these omissions, and this might change in future releases.