X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fcolor.h;h=be51156dc084965c00545426dda8d61ff79e9e75;hb=35287d4fef8dc61a10966091ff662eeb9444f87a;hp=9a89387cbadcce0bca0c838a8ed30f05c245b893;hpb=5a7178a44f067581d3acd8cff8c0801354d0c61f;p=ginac.git diff --git a/ginac/color.h b/ginac/color.h index 9a89387c..be51156d 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -3,7 +3,7 @@ * Interface to 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 @@ -51,6 +51,7 @@ public: // functions overriding virtual functions from base classes protected: + bool match_same_type(const basic & other) const; ex simplify_ncmul(const exvector & v) const; ex thisexprseq(const exvector & v) const; ex thisexprseq(exvector * vp) const; @@ -72,7 +73,7 @@ class su3one : public tensor { GINAC_DECLARE_REGISTERED_CLASS(su3one, tensor) - // functions overriding virtual functions from bases classes + // functions overriding virtual functions from base classes public: void print(const print_context & c, unsigned level = 0) const; }; @@ -82,9 +83,10 @@ class su3t : public tensor { GINAC_DECLARE_REGISTERED_CLASS(su3t, tensor) - // functions overriding virtual functions from bases classes + // functions overriding virtual functions from base classes public: void print(const print_context & c, unsigned level = 0) const; + bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const; }; /** This class represents the tensor of antisymmetric su(3) structure @@ -93,7 +95,7 @@ class su3f : public tensor { GINAC_DECLARE_REGISTERED_CLASS(su3f, tensor) - // functions overriding virtual functions from bases classes + // functions overriding virtual functions from base classes public: void print(const print_context & c, unsigned level = 0) const; ex eval_indexed(const basic & i) const; @@ -105,7 +107,7 @@ class su3d : public tensor { GINAC_DECLARE_REGISTERED_CLASS(su3d, tensor) - // functions overriding virtual functions from bases classes + // functions overriding virtual functions from base classes public: void print(const print_context & c, unsigned level = 0) const; ex eval_indexed(const basic & i) const; @@ -114,12 +116,13 @@ public: // global functions -inline const color &ex_to_color(const ex &e) + +/** Specialization of is_exactly_a(obj) for color objects. */ +template<> inline bool is_exactly_a(const basic & obj) { - return static_cast(*e.bp); + return obj.tinfo()==TINFO_color; } - /** Create the su(3) unity element. This is an indexed object, although it * has no indices. * @@ -153,6 +156,13 @@ ex color_d(const ex & a, const ex & b, const ex & c); /** This returns the linear combination d.a.b.c+I*f.a.b.c. */ ex color_h(const ex & a, const ex & b, const ex & c); +/** Calculate the trace of an expression containing color objects with a + * specified representation label. + * + * @param e Expression to take the trace of + * @param rl Representation label */ +ex color_trace(const ex & e, unsigned char rl = 0); + } // namespace GiNaC