GiNaC 1.8.10
color.h
Go to the documentation of this file.
1
5/*
6 * GiNaC Copyright (C) 1999-2026 Johannes Gutenberg University Mainz, Germany
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef GINAC_COLOR_H
23#define GINAC_COLOR_H
24
25#include "indexed.h"
26#include "tensor.h"
27
28#include <set>
29
30namespace GiNaC {
31
39class color : public indexed
40{
42 // other constructors
43public:
44 color(const ex & b, unsigned char rl = 0);
45 color(const ex & b, const ex & i1, unsigned char rl = 0);
46
47 // internal constructors
48 color(unsigned char rl, const exvector & v);
49 color(unsigned char rl, exvector && v);
50 void archive(archive_node& n) const override;
51 void read_archive(const archive_node& n, lst& sym_lst) override;
52
53 // functions overriding virtual functions from base classes
54protected:
55 ex eval_ncmul(const exvector & v) const override;
56 bool match_same_type(const basic & other) const override;
57 ex thiscontainer(const exvector & v) const override;
58 ex thiscontainer(exvector && v) const override;
59 unsigned return_type() const override { return return_types::noncommutative; }
60 return_type_t return_type_tinfo() const override;
61
62 // non-virtual functions in this class
63public:
64 unsigned char get_representation_label() const {return representation_label;}
65
66 // member variables
67private:
68 unsigned char representation_label;
69};
71
72
74class su3one : public tensor
75{
77
78 // non-virtual functions in this class
79protected:
80 void do_print(const print_context & c, unsigned level) const;
81 void do_print_latex(const print_latex & c, unsigned level) const;
82};
84
86class su3t : public tensor
87{
89
90 // functions overriding virtual functions from base classes
91public:
92 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
93
94 // non-virtual functions in this class
95protected:
96 void do_print(const print_context & c, unsigned level) const;
97 void do_print_latex(const print_latex & c, unsigned level) const;
98};
100
103class su3f : public tensor
104{
106
107 // functions overriding virtual functions from base classes
108public:
109 ex eval_indexed(const basic & i) const override;
110 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
111protected:
112 unsigned return_type() const override { return return_types::commutative; }
113
114 // non-virtual functions in this class
115protected:
116 void do_print(const print_context & c, unsigned level) const;
117 void do_print_latex(const print_latex & c, unsigned level) const;
118};
120
122class su3d : public tensor
123{
125
126 // functions overriding virtual functions from base classes
127public:
128 ex eval_indexed(const basic & i) const override;
129 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
130protected:
131 unsigned return_type() const override { return return_types::commutative; }
132
133 // non-virtual functions in this class
134protected:
135 void do_print(const print_context & c, unsigned level) const;
136 void do_print_latex(const print_latex & c, unsigned level) const;
137};
139
140
141// global functions
142
148ex color_ONE(unsigned char rl = 0);
149
155ex color_T(const ex & a, unsigned char rl = 0);
156
163ex color_f(const ex & a, const ex & b, const ex & c);
164
171ex color_d(const ex & a, const ex & b, const ex & c);
172
174ex color_h(const ex & a, const ex & b, const ex & c);
175
180ex color_trace(const ex & e, const std::set<unsigned char> & rls);
181
186ex color_trace(const ex & e, const lst & rll);
187
193ex color_trace(const ex & e, unsigned char rl = 0);
194
195} // namespace GiNaC
196
197#endif // ndef GINAC_COLOR_H
#define GINAC_DECLARE_UNARCHIVER(classname)
Helper macros to register a class with (un)archiving (a.k.a.
Definition archive.h:218
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition archive.h:48
This class holds archived versions of GiNaC expressions (class ex).
Definition archive.h:254
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Definition basic.h:104
This class holds a generator T_a or the unity element of the Lie algebra of SU(3),...
Definition color.h:40
return_type_t return_type_tinfo() const override
Definition color.cpp:95
ex eval_ncmul(const exvector &v) const override
Perform automatic simplification on noncommutative product of color objects.
Definition color.cpp:161
unsigned char representation_label
Representation label to distinguish independent color matrices coming from separated fermion lines.
Definition color.h:68
unsigned return_type() const override
Definition color.h:59
unsigned char get_representation_label() const
Definition color.h:64
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
Definition color.cpp:104
bool match_same_type(const basic &other) const override
Returns true if the attributes of two objects are similar enough for a match.
Definition color.cpp:141
ex thiscontainer(const exvector &v) const override
Definition color.cpp:178
Wrapper template for making GiNaC classes out of STL containers.
Definition container.h:72
Lightweight wrapper for GiNaC's symbolic objects.
Definition ex.h:72
This class holds an indexed expression.
Definition indexed.h:39
Base class for print_contexts.
Definition print.h:101
Context for latex-parsable output.
Definition print.h:121
This class represents the tensor of symmetric su(3) structure constants.
Definition color.h:123
unsigned return_type() const override
Definition color.h:131
void do_print_latex(const print_latex &c, unsigned level) const
void do_print(const print_context &c, unsigned level) const
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed symmetric structure constant.
Definition color.cpp:220
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed symmetric structure constant with something else.
Definition color.cpp:358
This class represents the tensor of antisymmetric su(3) structure constants.
Definition color.h:104
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed antisymmetric structure constant.
Definition color.cpp:265
unsigned return_type() const override
Definition color.h:112
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed antisymmetric structure constant with something else.
Definition color.cpp:415
void do_print(const print_context &c, unsigned level) const
void do_print_latex(const print_latex &c, unsigned level) const
This class represents the su(3) unity element.
Definition color.h:75
void do_print(const print_context &c, unsigned level) const
void do_print_latex(const print_latex &c, unsigned level) const
This class represents an su(3) generator.
Definition color.h:87
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of generator with something else.
Definition color.cpp:303
void do_print(const print_context &c, unsigned level) const
void do_print_latex(const print_latex &c, unsigned level) const
This class holds one of GiNaC's predefined special tensors such as the delta and the metric tensors.
Definition tensor.h:34
size_t n
Definition factor.cpp:1431
size_t c
Definition factor.cpp:756
Interface to GiNaC's indexed expressions.
Definition add.cpp:35
ex color_ONE(unsigned char rl)
Create the su(3) unity element.
Definition color.cpp:469
ex color_T(const ex &a, unsigned char rl)
Create an su(3) generator.
Definition color.cpp:475
ex color_trace(const ex &e, const std::set< unsigned char > &rls)
Calculate color traces over the specified set of representation labels.
Definition color.cpp:530
ex color_f(const ex &a, const ex &b, const ex &c)
Create an su(3) antisymmetric structure constant.
Definition color.cpp:487
ex color_h(const ex &a, const ex &b, const ex &c)
This returns the linear combination d.a.b.c+I*f.a.b.c.
Definition color.cpp:511
ex color_d(const ex &a, const ex &b, const ex &c)
Create an su(3) symmetric structure constant.
Definition color.cpp:499
std::vector< ex > exvector
Definition basic.h:47
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition registrar.h:151
To distinguish between different kinds of non-commutative objects.
Definition registrar.h:42
Interface to GiNaC's special tensors.

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.