From 0a24789398c83901cda0b51ae79acf7d101a390f Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 30 Jul 2001 17:32:47 +0000 Subject: [PATCH] - (a+b)*gamma5 was incorrectly rewritten as -gamma5*(a+b) --- check/exam_clifford.cpp | 11 +++++++++++ ginac/clifford.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/check/exam_clifford.cpp b/check/exam_clifford.cpp index 287a600d..fc97ac02 100644 --- a/check/exam_clifford.cpp +++ b/check/exam_clifford.cpp @@ -173,6 +173,17 @@ static unsigned clifford_check3(void) e = dirac_trace(e).simplify_indexed(sp); result += check_equal(e, 4*(2*ldotq*ldotq + q*q*ldotq - q*q*l*l + q*q*m*m).expand()); + // stuff that had problems in the past + ex prop = dirac_slash(q, dim) - m * dirac_ONE(); + e = dirac_slash(l, dim) * dirac_gamma5() * dirac_slash(l, dim) * prop; + e = dirac_trace(dirac_slash(q, dim) * e) - dirac_trace(m * e) + - dirac_trace(prop * e); + result += check_equal(e, 0); + + e = (dirac_gamma5() + dirac_ONE()) * dirac_gamma5(); + e = dirac_trace(e); + result += check_equal(e, 4); + return result; } diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index f6a511c4..13bb8b0e 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -281,7 +281,7 @@ ex clifford::simplify_ncmul(const exvector & v) const // Remove superfluous ONEs exvector::const_iterator cit = v.begin(), citend = v.end(); while (cit != citend) { - if (!is_a(cit->op(0))) + if (!is_a(*cit) || !is_a(cit->op(0))) s.push_back(*cit); cit++; } @@ -296,7 +296,7 @@ ex clifford::simplify_ncmul(const exvector & v) const exvector::iterator it = next_to_last; while (true) { exvector::iterator it2 = it + 1; - if (!is_a(it->op(0)) && is_a(it2->op(0))) { + if (is_a(*it) && is_a(*it2) && !is_a(it->op(0)) && is_a(it2->op(0))) { it->swap(*it2); sign = -sign; something_changed = true; @@ -312,7 +312,7 @@ ex clifford::simplify_ncmul(const exvector & v) const } // Remove squares of gamma5 - while (s.size() >= 2 && is_a(s[0].op(0)) && is_a(s[1].op(0))) { + while (s.size() >= 2 && is_a(s[0]) && is_a(s[1]) && is_a(s[0].op(0)) && is_a(s[1].op(0))) { s.erase(s.begin(), s.begin() + 2); something_changed = true; } @@ -321,10 +321,10 @@ ex clifford::simplify_ncmul(const exvector & v) const if (s.size() >= 2) { exvector::iterator it, itend = s.end() - 1; for (it = s.begin(); it != itend; ++it) { - if (!is_a(it[0])) - continue; ex & a = it[0]; ex & b = it[1]; + if (!is_a(a) || !is_a(b)) + continue; if (is_a(a.op(0)) && is_a(b.op(0))) { const ex & ia = a.op(1); const ex & ib = b.op(1); -- 2.44.0