]> www.ginac.de Git - ginac.git/blobdiff - ginac/color.cpp
documentation update
[ginac.git] / ginac / color.cpp
index dd8ee18dc3606861efb2c886ef93a91599a9f916..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
@@ -20,7 +20,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <algorithm>
+#include <iostream>
 #include <stdexcept>
 
 #include "color.h"
@@ -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);