Next: , Previous: Creating displacement shifts, Up: Shifts


Creating arbitrary permutations

Syntax QDP_Shift QDP_create_map(void *(func*)(int rx[Nd], int sx[Nd], QDP_ShiftDir fb, void *args), void *args, int argsize);


Meaning Creates a shift specified by the permutation map func.


Example int mu = 1;
QDP_Shift mirror[4];
mirror[mu] = QDP_create_map(reflect, &mu, sizeof(mu));
where reflect(rx,sx,QDP_forward,mu) sets sx[i] = rx[i] except for sx[mu] = L[mu] - 1 - rx[mu].

The return value is used in the various linear algebra calls involving shifts. The arguments args are passed through to the calling function. The argsize parameter specifies the byte length of the argument array or structure.

The implementation may choose to postpone construction of a shift. Thus it is required that the callback function func be static and invariant, i.e. a function call with the same arguments must give the same result, even if the call is postponed. The parameters args are copied at the moment the shift is created, however, so they may be volatile. The size argument argsize makes copying possible.