* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
+#include <iostream>
#include <stdexcept>
#include "color.h"
#include "symbol.h"
#include "print.h"
#include "archive.h"
-#include "debugmsg.h"
#include "utils.h"
namespace GiNaC {
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;
}
* @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;
}
* @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;
}
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;
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);