The example in this section uses an intra-communicator.
Example
This example uses a user-defined operation to produce a segmented
scan.
A segmented scan takes, as input, a set of values and a set of logicals,
and the logicals delineate the various segments of the scan.
For example:
The operator that produces this effect is
where
Note that this is a noncommutative operator. C code that implements it is given below.
Note that the inout argument to the user-defined function corresponds to the right-hand operand of the operator. When using this operator, we must be careful to specify that it is noncommutative, as in the following.