X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fclifford.cpp;h=3af4fcae1eab2b374e900d58192cf107a3406974;hb=b1da89e057fea6f9c9c6e32bd92ecb5980b6713a;hp=b5dff072b6601d2bb2893d7149e29eac50cdcf94;hpb=aaa543fc188debc7332255f2e7e0559e6d40b754;p=ginac.git diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index b5dff072..3af4fcae 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -345,6 +345,42 @@ static bool is_clifford_tinfo(unsigned ti) return (ti & ~0xff) == TINFO_clifford; } +/** Take trace of a string of an even number of Dirac gammas given a vector + * of indices. */ +static ex trace_string(exvector::const_iterator ix, unsigned num) +{ + // Tr gamma.mu gamma.nu = 4 g.mu.nu + if (num == 2) + return lorentz_g(ix[0], ix[1]); + + // Tr gamma.mu gamma.nu gamma.rho gamma.sig = 4 (g.mu.nu g.rho.sig + g.nu.rho g.mu.sig - g.mu.rho g.nu.sig + else if (num == 4) + return lorentz_g(ix[0], ix[1]) * lorentz_g(ix[2], ix[3]) + + lorentz_g(ix[1], ix[2]) * lorentz_g(ix[0], ix[3]) + - lorentz_g(ix[0], ix[2]) * lorentz_g(ix[1], ix[3]); + + // Traces of 6 or more gammas are computed recursively: + // Tr gamma.mu1 gamma.mu2 ... gamma.mun = + // + g.mu1.mu2 * Tr gamma.mu3 ... gamma.mun + // - g.mu1.mu3 * Tr gamma.mu2 gamma.mu4 ... gamma.mun + // + g.mu1.mu4 * Tr gamma.mu3 gamma.mu3 gamma.mu5 ... gamma.mun + // - ... + // + g.mu1.mun * Tr gamma.mu2 ... gamma.mu(n-1) + exvector v(num - 2); + int sign = 1; + ex result; + for (int i=1; i iv; - iv.reserve(num-1); + ex idx4 = ix[l]; + iv[0] = i; iv[1] = j; iv[2] = k; iv[3] = l; exvector v; - v.reserve(num-1); - iv.push_back(i); iv.push_back(j); iv.push_back(k); iv.push_back(l); - for (int n=1; n