Next: , Previous: Subsets, Up: QDP Functions


4.6 Shifts

Shifts are general communication operations specified by any permutation of sites. Nearest neighbor shifts are a special case and are preinitialized by QDP_initialize. Arbitrary displacement shifts are an intermediate generalization and are created with QDP_create_shift. Arbitrary permutations are created with QDP_create_map. However they are created, all shifts are specified by a direction label dir of type QDP_Shift and a sign sign of type QDP_ShiftDir that takes one of two predefined values QDP_forward and QDP_backward.

Shifts are treated syntactically as a modification of a QDP argument and are specified with a prefix s before the type abbreviation for the shifted field. Thus, for example,

QDP_H_eq_sH(r, a, dir, sign, s);

shifts the half fermion field a along direction dir, forward or backward according to sign, placing the result in the field r. Nearest neighbor shifts are specified by values of the global shift QDP_neighbor[mu] with mu in the range [0, Ndim-1]. The sign is QDP_forward for shifts from the positive direction, and QDP_backward for shifts from the negative direction. That is, for QDP_forward and dir = QDP_neighbor[mu], r(x) = a(x+mu). For more general shifts, the direction dir is specified by the object returned by QDP_create_shift or QDP_create_map and sign must be either QDP_forward or QDP_backward to specify the permutation or its inverse, respectively.

The subset restriction applies to the destination field r. Thus a nearest neighbor shift operation specifying the even subset shifts odd site values from the source a and places them on even site values on the destination field r.