next up previous contents
Next: Effect and Restrictions Up: The Java Adlib API Previous: Effect and Restrictions   Contents


Shift

A shift() method is a communication schedule for shifting the elements of a distributed array along one of its dimensions, placing the result in another array. The source and destination arrays must have the same shape and element-type, and they must be identically aligned. The shift() operation does not copy values from source array that would go past the edge of destination array, and at the other extreme of the range elements of destination that are not targeted by elements from source array are unchanged from their input value. The related operation cshift() is essentially identical to shift() except that it implements a circular shift, rather then an ``edge-off'' shift. General signatures of shift() function are

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ void...
...ion, $$T$\verb$ [[-]] source, int shiftAmount)$
\end{tabbing}
\end{minipage}
$

and

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$ void...
...e, int shiftAmount,$\\
\verb$ int dimension)$
\end{tabbing}
\end{minipage}
$

where the variable $ T$ runs over all primitive types and Object, and the notation $ T$ # means a multiarray of arbitrary rank, with elements of type $ T$. The first form applies only for one dimensional multiarrays. The second form applies to multiarrays of any rank. The shiftAmount argument, which may be negative, specifies the amount and direction of the shift. In the second form the dimension argument is in the range 0, ...,$ R$-1 where $ R$ is the rank of the arrays. The shift method is implemented by a schedule object with HPspmd class Shift$ T$. Each primitive type and Object has its own schedule class. This class has a constructor with arguments identical to the method above, and has one public method with no arguments called execute(), which executes the schedule. The effective public interface of the Shift$ T$ class is

$\displaystyle \begin{minipage}[t]{\linewidth}\small\verb$ public class Shift$$T...
...ublic void execute () { ... }$\\
\verb$ . . .$\\
\verb$ }$
\end{minipage}
$

The source array is the source and the destination array is destination. The shift mount is given by shiftAmount. The dimension argument selects the array dimension in which the shift occurs. The flag mode specifies the type of shift. It takes one of the values Adlib.CYCL, Adlib.EDGE, or Adlib.NONE.

Subsections
next up previous contents
Next: Effect and Restrictions Up: The Java Adlib API Previous: Effect and Restrictions   Contents
Bryan Carpenter 2004-06-09