The method shift() is a communication schedule for shifting the elements of a distributed array along one of its dimensions, placing the result in another array. In general we have the signatures:
#means a multiarray of arbitrary rank, with elements of type . 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 where is the rank of the arrays: it selects the array dimension in which the shift occurs. The source and destination arrays must have the same shape, and they must also be identically aligned. By design, shift() implements a simpler pattern of communication than general remap(). The alignment relation allows for a more efficient implementation. The library incorporates runtime checks on alignment relations between arguments, where these are required.
The shift() operation does not copy values from source that would go past the edge of destination, and at the other extreme of the range elements of destination that are not targetted by elements from source are unchanged from their input value. The related operation cshift() is essentially identical to shift() except that it implements a circular shift, rather than an ``edge-off'' shift.
Finally we mention the function broadcast(), which is actually a simplified form of remap(). There are two signatures:
The second form of broadcast() just takes an ordinary Java value as the source. This value should be defined on the process or group of processes identified by root. It is broadcast to all members of the active process group.