From: Christian Bauer Date: Fri, 11 May 2001 18:05:32 +0000 (+0000) Subject: - dirac_trace() takes an optional third argument: the expression to use for X-Git-Tag: release_0-8-3~4 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=08af38543754f923653d73fd84625bb8a35b0136 - dirac_trace() takes an optional third argument: the expression to use for the trace of the unit matrix - more conventional factor I in gamma5 --- diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 32096410..5c7f7c3b 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -25,6 +25,7 @@ #include "idx.h" #include "ncmul.h" #include "symbol.h" +#include "numeric.h" // for I #include "print.h" #include "archive.h" #include "debugmsg.h" @@ -336,13 +337,13 @@ static bool is_clifford_tinfo(unsigned ti, unsigned char rl) return ti == (TINFO_clifford + rl); } -ex dirac_trace(const ex & e, unsigned char rl) +ex dirac_trace(const ex & e, unsigned char rl, const ex & trONE) { if (is_ex_of_type(e, clifford)) { if (ex_to_clifford(e).get_representation_label() == rl && is_ex_of_type(e.op(0), diracone)) - return _ex4(); + return trONE; else return _ex0(); @@ -351,7 +352,7 @@ ex dirac_trace(const ex & e, unsigned char rl) // Trace of sum = sum of traces ex sum = _ex0(); for (unsigned i=0; isetflag(status_flags::dynallocated), dim), mu2((new symbol)->setflag(status_flags::dynallocated), dim), @@ -406,7 +407,7 @@ ex dirac_trace(const ex & e, unsigned char rl) v.push_back(e.op(i)); return (eps0123(mu1.toggle_variance(), mu2.toggle_variance(), mu3.toggle_variance(), mu4.toggle_variance()) * - dirac_trace(ncmul(v), rl)).simplify_indexed() / 24; + dirac_trace(ncmul(v), rl, trONE)).simplify_indexed() * I / 24; } else { // no gamma5 @@ -416,7 +417,7 @@ ex dirac_trace(const ex & e, unsigned char rl) // Tr gamma.mu gamma.nu = 4 g.mu.nu if (num == 2) - return 4 * lorentz_g(e.op(0).op(1), e.op(1).op(1)); + return trONE * lorentz_g(e.op(0).op(1), e.op(1).op(1)); // Traces of 4 or more gammas are computed recursively: // Tr gamma.mu1 gamma.mu2 ... gamma.mun = @@ -435,7 +436,7 @@ ex dirac_trace(const ex & e, unsigned char rl) continue; v[j++] = e.op(n); } - result += sign * lorentz_g(ix1, e.op(i).op(1)) * dirac_trace(ncmul(v), rl); + result += sign * lorentz_g(ix1, e.op(i).op(1)) * dirac_trace(ncmul(v), rl, trONE); sign = -sign; } return result; diff --git a/ginac/clifford.h b/ginac/clifford.h index 69c9e23a..42be538f 100644 --- a/ginac/clifford.h +++ b/ginac/clifford.h @@ -144,8 +144,10 @@ ex dirac_slash(const ex & e, const ex & dim, unsigned char rl = 0); * In particular, the functional is not always cyclic in D != 4 dimensions * when gamma5 is involved. * - * @param rl Representation label */ -ex dirac_trace(const ex & e, unsigned char rl = 0); + * @param e Expression to take the trace of + * @param rl Representation label + * @param trONE Expression to be returned as the trace of the unit matrix */ +ex dirac_trace(const ex & e, unsigned char rl = 0, const ex & trONE = 4); } // namespace GiNaC diff --git a/ginac/color.h b/ginac/color.h index 48903e45..eb273c71 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -157,6 +157,7 @@ ex color_h(const ex & a, const ex & b, const ex & c); /** Calculate the trace of an expression containing color objects with a * specified representation label. * + * @param e Expression to take the trace of * @param rl Representation label */ ex color_trace(const ex & e, unsigned char rl = 0);