]> www.ginac.de Git - ginac.git/blobdiff - ginac/color.cpp
- prepared for 1.0.13 release
[ginac.git] / ginac / color.cpp
index 642da5c02125ac0b9a8fa4f33eb5870dc891dbd5..4c50a6e7dd8f8c2b2abcab33eb927e2e869cbd78 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-2003 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"
@@ -33,7 +33,6 @@
 #include "symbol.h"
 #include "print.h"
 #include "archive.h"
-#include "debugmsg.h"
 #include "utils.h"
 
 namespace GiNaC {
@@ -45,12 +44,11 @@ GINAC_IMPLEMENT_REGISTERED_CLASS(su3f, tensor)
 GINAC_IMPLEMENT_REGISTERED_CLASS(su3d, tensor)
 
 //////////
-// default constructor, destructor, copy constructor assignment operator and helpers
+// default ctor, dtor, copy ctor, assignment operator and helpers
 //////////
 
 color::color() : representation_label(0)
 {
-       debugmsg("color default constructor", LOGLEVEL_CONSTRUCT);
        tinfo_key = TINFO_color;
 }
 
@@ -75,7 +73,6 @@ DEFAULT_CTORS(su3d)
  *  @see color_ONE */
 color::color(const ex & b, unsigned char rl) : inherited(b), representation_label(rl)
 {
-       debugmsg("color constructor from ex,unsigned char", LOGLEVEL_CONSTRUCT);
        tinfo_key = TINFO_color;
 }
 
@@ -84,19 +81,16 @@ color::color(const ex & b, unsigned char rl) : inherited(b), representation_labe
  *  @see color_T */
 color::color(const ex & b, const ex & i1, unsigned char rl) : inherited(b, i1), representation_label(rl)
 {
-       debugmsg("color constructor from ex,ex,unsigned char", LOGLEVEL_CONSTRUCT);
        tinfo_key = TINFO_color;
 }
 
 color::color(unsigned char rl, const exvector & v, bool discardable) : inherited(sy_none(), v, discardable), representation_label(rl)
 {
-       debugmsg("color constructor from unsigned char,exvector", LOGLEVEL_CONSTRUCT);
        tinfo_key = TINFO_color;
 }
 
 color::color(unsigned char rl, exvector * vp) : inherited(sy_none(), vp), representation_label(rl)
 {
-       debugmsg("color constructor from unsigned char,exvector *", LOGLEVEL_CONSTRUCT);
        tinfo_key = TINFO_color;
 }
 
@@ -106,7 +100,6 @@ color::color(unsigned char rl, exvector * vp) : inherited(sy_none(), vp), repres
 
 color::color(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
 {
-       debugmsg("color constructor from archive_node", LOGLEVEL_CONSTRUCT);
        unsigned rl;
        n.find_unsigned("label", rl);
        representation_label = rl;
@@ -315,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);