GiNaC  1.8.0
color.h
Go to the documentation of this file.
1 
5 /*
6  * GiNaC Copyright (C) 1999-2020 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, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef GINAC_COLOR_H
24 #define GINAC_COLOR_H
25 
26 #include "indexed.h"
27 #include "tensor.h"
28 
29 #include <set>
30 
31 namespace GiNaC {
32 
40 class color : public indexed
41 {
43  // other constructors
44 public:
45  color(const ex & b, unsigned char rl = 0);
46  color(const ex & b, const ex & i1, unsigned char rl = 0);
47 
48  // internal constructors
49  color(unsigned char rl, const exvector & v);
50  color(unsigned char rl, exvector && v);
51  void archive(archive_node& n) const override;
52  void read_archive(const archive_node& n, lst& sym_lst) override;
53 
54  // functions overriding virtual functions from base classes
55 protected:
56  ex eval_ncmul(const exvector & v) const override;
57  bool match_same_type(const basic & other) const override;
58  ex thiscontainer(const exvector & v) const override;
59  ex thiscontainer(exvector && v) const override;
60  unsigned return_type() const override { return return_types::noncommutative; }
61  return_type_t return_type_tinfo() const override;
62 
63  // non-virtual functions in this class
64 public:
65  unsigned char get_representation_label() const {return representation_label;}
66 
67  // member variables
68 private:
69  unsigned char representation_label;
70 };
72 
73 
75 class su3one : public tensor
76 {
78 
79  // non-virtual functions in this class
80 protected:
81  void do_print(const print_context & c, unsigned level) const;
82  void do_print_latex(const print_latex & c, unsigned level) const;
83 };
85 
87 class su3t : public tensor
88 {
90 
91  // functions overriding virtual functions from base classes
92 public:
93  bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
94 
95  // non-virtual functions in this class
96 protected:
97  void do_print(const print_context & c, unsigned level) const;
98  void do_print_latex(const print_latex & c, unsigned level) const;
99 };
101 
104 class su3f : public tensor
105 {
107 
108  // functions overriding virtual functions from base classes
109 public:
110  ex eval_indexed(const basic & i) const override;
111  bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
112 protected:
113  unsigned return_type() const override { return return_types::commutative; }
114 
115  // non-virtual functions in this class
116 protected:
117  void do_print(const print_context & c, unsigned level) const;
118  void do_print_latex(const print_latex & c, unsigned level) const;
119 };
121 
123 class su3d : public tensor
124 {
126 
127  // functions overriding virtual functions from base classes
128 public:
129  ex eval_indexed(const basic & i) const override;
130  bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
131 protected:
132  unsigned return_type() const override { return return_types::commutative; }
133 
134  // non-virtual functions in this class
135 protected:
136  void do_print(const print_context & c, unsigned level) const;
137  void do_print_latex(const print_latex & c, unsigned level) const;
138 };
140 
141 
142 // global functions
143 
149 ex color_ONE(unsigned char rl = 0);
150 
156 ex color_T(const ex & a, unsigned char rl = 0);
157 
164 ex color_f(const ex & a, const ex & b, const ex & c);
165 
172 ex color_d(const ex & a, const ex & b, const ex & c);
173 
175 ex color_h(const ex & a, const ex & b, const ex & c);
176 
181 ex color_trace(const ex & e, const std::set<unsigned char> & rls);
182 
187 ex color_trace(const ex & e, const lst & rll);
188 
194 ex color_trace(const ex & e, unsigned char rl = 0);
195 
196 } // namespace GiNaC
197 
198 #endif // ndef GINAC_COLOR_H
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:417
ex color_d(const ex &a, const ex &b, const ex &c)
Create an su(3) symmetric structure constant.
Definition: color.cpp:501
This class holds a generator T_a or the unity element of the Lie algebra of SU(3), as used for calculations in quantum chromodynamics.
Definition: color.h:40
unsigned return_type() const override
Definition: color.h:113
Interface to GiNaC&#39;s indexed expressions.
unsigned char representation_label
Representation label to distinguish independent color matrices coming from separated fermion lines...
Definition: color.h:69
unsigned return_type() const override
Definition: color.h:132
Definition: add.cpp:38
unsigned char get_representation_label() const
Definition: color.h:65
void do_print(const print_context &c, unsigned level) const
return_type_t return_type_tinfo() const override
Definition: color.cpp:97
color(const ex &b, unsigned char rl=0)
Construct object without any color index.
Definition: color.cpp:78
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:532
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed symmetric structure constant.
Definition: color.cpp:222
This class is the ABC (abstract base class) of GiNaC&#39;s class hierarchy.
Definition: basic.h:104
This class holds one of GiNaC&#39;s predefined special tensors such as the delta and the metric tensors...
Definition: tensor.h:34
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:143
This class represents the tensor of antisymmetric su(3) structure constants.
Definition: color.h:104
void do_print_latex(const print_latex &c, unsigned level) const
container< std::list > lst
Definition: lst.h:32
Interface to GiNaC&#39;s special tensors.
Context for latex-parsable output.
Definition: print.h:122
void archive(archive_node &n) const override
Save (serialize) the object into archive node.
Definition: color.cpp:114
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of generator with something else.
Definition: color.cpp:305
This class holds an indexed expression.
Definition: indexed.h:39
void do_print_latex(const print_latex &c, unsigned level) const
void do_print(const print_context &c, unsigned level) const
This class represents an su(3) generator.
Definition: color.h:87
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
Definition: color.cpp:106
To distinguish between different kinds of non-commutative objects.
Definition: registrar.h:43
This class represents the su(3) unity element.
Definition: color.h:75
std::vector< ex > exvector
Definition: basic.h:46
void do_print(const print_context &c, unsigned level) const
ex thiscontainer(const exvector &v) const override
Definition: color.cpp:180
size_t n
Definition: factor.cpp:1463
Base class for print_contexts.
Definition: print.h:102
void do_print_latex(const print_latex &c, unsigned level) const
void do_print_latex(const print_latex &c, unsigned level) const
ex color_f(const ex &a, const ex &b, const ex &c)
Create an su(3) antisymmetric structure constant.
Definition: color.cpp:489
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:513
unsigned return_type() const override
Definition: color.h:60
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition: archive.h:48
Lightweight wrapper for GiNaC&#39;s symbolic objects.
Definition: ex.h:72
void do_print(const print_context &c, unsigned level) const
ex color_ONE(unsigned char rl)
Create the su(3) unity element.
Definition: color.cpp:471
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition: registrar.h:153
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed antisymmetric structure constant.
Definition: color.cpp:267
This class represents the tensor of symmetric su(3) structure constants.
Definition: color.h:123
GINAC_DECLARE_UNARCHIVER(add)
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:360
size_t c
Definition: factor.cpp:770
ex eval_ncmul(const exvector &v) const override
Perform automatic simplification on noncommutative product of color objects.
Definition: color.cpp:163
ex color_T(const ex &a, unsigned char rl)
Create an su(3) generator.
Definition: color.cpp:477

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