Dot Products

Contracting two fields with qcd.dot() and summing the result.

To compute a dot product of two lattice fields, one can use a combination of the qcd.dot() function and the :sum() method. Here we develop an example with Dirac Propagators, but this approach works for all lattice types.

Let us start with creating a lattice and a random generator:

L = qcd.lattice{4,6,4,4};

do
   local x = L:Int(235);
   for i = 0, #L - 1 do
      x = x * L[i] + L:pcoord(i);
   end
   S = L:RandomState(65,x);
end

Next, create a couple of random propagators

A = S:gaussian_DiracPropagator();
B = S:gaussian_DiracPropagator();

Finally, the dot product is computed as follows

AdotB = qcd.dot(A,B):sum();