next up previous contents index
Next: Partial Reductions. Up: Reductions and Scans Previous: Reductions and Scans

Partial Scans.

   

The scan operators compute the parallel prefix of all elements of a parallel expression. A partial scan is similar except the parallel prefix is computed over certain dimensions of the parallel expression, as indicated by an optional parameter that proceeds the scan operator. For example, as shown below, a scan across the first dimension of a 2D array produces an array in which each element is the sum of the elements to the left of it (in the same row).

    V := +|| [1] A;           -- scan the first dimension of A
The optional parameter is enclosed in square braces and must be an integer literal type. A negative dimension indicates that the scan is to be performed in reverse order, i.e., from the largest index to the smallest for the specified dimension.



Kay Nettle
Fri Feb 21 21:14:29 CST 1997