For the position-space representation of the field, with and , one can index the field into a single -dimensional vector, using the single index instead of all the position coordinates, where
Defined in this way the index runs from to , thus enumerating all the sites of the lattice. There is also an algorithm to obtain the components of back from the value of , as we will discuss later. We would like to do the same for the momentum-space representation , with , , where the extremes of the range are defined as
for odd , and as
for even . In order for the index value of to correspond to the zero mode , we would like to use the index given by
In order to show that one can in fact do this, and to discover how to invert the relation, getting the components of out of , we start with a version of the momentum-space index just like the position-space one,
which ranges from to and where , , just like the position-space index. Now, starting from this index we have
where is always divisible by , of course. Therefore, considering the definition of , we have
Since the two indices are related by an additive constant, either one can be used to index the modes. Since ranges from to , we have for the extreme values of
Note that is negative, so that the lower extreme is negative. For odd the extremes can be written explicitly as
and the range is therefore symmetrical around . Note that since is odd so is , and therefore is even and thus divisible by . For even we get
so that in this case the range is not symmetrical, and there are more positive-index elements than negative-index elements. A little analysis will show that the integer divisions are exact in this case also, without any truncation: since is always divisible by , we are left with and to be considered, and since is even both and are divisible by .
If we recall our organization of real and imaginary parts as independent coordinates, as described in the previous section, it is interesting to observe that one can verify that for odd the negative values of correspond to imaginary parts, the value to the real mode, and the positive values to real parts. However, the same is not true for even , due to the modes with one or more components equal to , some of which have their imaginary parts at positive values of the index. Due to this, in general it will be necessary to implement an additional pair of indexing arrays in order to map real parts to the corresponding imaginary parts and vice-versa, whenever it becomes necessary to recover the two parts of one and the same mode.
It remains for us to discuss the inversion algorithm. The algorithm for extracting the position coordinates from the position-space index works by integer division, with truncation, and in dimensions is given by
where is a temporary variable. It is therefore clear that we can use exactly the same algorithm for extracting the shifted momentum coordinates from the index . Since and are related by an additive constant, we can also use the algorithm for , so long as we start by adding to it the constant , and substitute by in the formulas, in order to get the components of , and therefore we have the algorithm
This completes the discussion of the indexing scheme in momentum space.