From 9254356cc8381a5c189eb48cd40f316916453172 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Tue, 25 Jun 2002 21:36:23 +0000 Subject: [PATCH 1/1] clifford and color objects are not contracted if their representation labels are different --- ginac/clifford.cpp | 7 +++++++ ginac/color.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 66ddc019..86678ecc 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -179,6 +179,9 @@ static void base_and_index(const ex & c, ex & b, ex & i) if (is_a(c.op(0))) { // proper dirac gamma object i = c.op(1); b = _ex1; + } else if (is_a(c.op(0))) { // gamma5 + i = _ex0; + b = _ex1; } else { // slash object, generate new dummy index varidx ix((new symbol)->setflag(status_flags::dynallocated), ex_to(c.op(1)).get_dim()); b = indexed(c.op(0), ix.toggle_variance()); @@ -196,6 +199,10 @@ bool diracgamma::contract_with(exvector::iterator self, exvector::iterator other if (is_a(*other)) { + // Contraction only makes sense if the represenation labels are equal + if (ex_to(*other).get_representation_label() != rl) + return false; + ex dim = ex_to(self->op(1)).get_dim(); // gamma~mu gamma.mu = dim ONE diff --git a/ginac/color.cpp b/ginac/color.cpp index aeaf112c..7d71facf 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -308,6 +308,11 @@ bool su3t::contract_with(exvector::iterator self, exvector::iterator other, exve if (is_ex_exactly_of_type(other->op(0), su3t)) { + // Contraction only makes sense if the represenation labels are equal + GINAC_ASSERT(is_a(*other)); + if (ex_to(*other).get_representation_label() != rl) + return false; + // T.a T.a = 4/3 ONE if (other - self == 1) { *self = numeric(4, 3); -- 2.44.0