]> www.ginac.de Git - ginac.git/blobdiff - ginac/color.cpp
clifford and color objects are not contracted if their representation labels
[ginac.git] / ginac / color.cpp
index 2459a2d4338e40fdaee8d5e3a5c3400ce44e439a..7d71facf896eb9aca5b0f32126ec4dc0a7480678 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's color (SU(3) Lie algebra) objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -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<color>(*other));
+               if (ex_to<color>(*other).get_representation_label() != rl)
+                       return false;
+
                // T.a T.a = 4/3 ONE
                if (other - self == 1) {
                        *self = numeric(4, 3);