X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fclifford.cpp;h=8a8bfe09294e942e88023d0770784f09d5d9f289;hb=43e0a8f5ca5e1c48cef5daaf014acdbca4e44568;hp=eb1629d4957aad08f5a001ac2348dc89752a07bb;hpb=5a7178a44f067581d3acd8cff8c0801354d0c61f;p=ginac.git diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index eb1629d4..8a8bfe09 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -24,6 +24,7 @@ #include "ex.h" #include "idx.h" #include "ncmul.h" +#include "symbol.h" #include "print.h" #include "archive.h" #include "debugmsg.h" @@ -301,7 +302,20 @@ ex dirac_gamma5(unsigned char rl) return clifford(diracgamma5(), rl); } -ex dirac_trace(const ex & e, unsigned char rl = 0) +ex dirac_slash(const ex & e, const ex & dim, unsigned char rl) +{ + varidx mu((new symbol)->setflag(status_flags::dynallocated), dim); + return indexed(e, mu.toggle_variance()) * dirac_gamma(mu, rl); +} + +/** Check whether a given tinfo key (as returned by return_type_tinfo() + * is that of a clifford object with the specified representation label. */ +static bool is_clifford_tinfo(unsigned ti, unsigned char rl) +{ + return ti == (TINFO_clifford + rl); +} + +ex dirac_trace(const ex & e, unsigned char rl) { if (is_ex_of_type(e, clifford)) { @@ -325,12 +339,8 @@ ex dirac_trace(const ex & e, unsigned char rl = 0) ex prod = _ex1(); for (unsigned i=0; isetflag(status_flags::dynallocated), dim), + mu2((new symbol)->setflag(status_flags::dynallocated), dim), + mu3((new symbol)->setflag(status_flags::dynallocated), dim), + mu4((new symbol)->setflag(status_flags::dynallocated), dim); + exvector v; + v.reserve(num + 3); + v.push_back(dirac_gamma(mu1, rl)); + v.push_back(dirac_gamma(mu2, rl)); + v.push_back(dirac_gamma(mu3, rl)); + v.push_back(dirac_gamma(mu4, rl)); + for (int i=1; i