GiNaC 1.8.8
clifford.h
Go to the documentation of this file.
1
5/*
6 * GiNaC Copyright (C) 1999-2025 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_CLIFFORD_H
24#define GINAC_CLIFFORD_H
25
26#include "indexed.h"
27#include "tensor.h"
28#include "symbol.h"
29#include "idx.h"
30
31#include <set>
32
33namespace GiNaC {
34
40class clifford : public indexed
41{
43 // other constructors
44public:
45 clifford(const ex & b, unsigned char rl = 0);
46 clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl = 0, int comm_sign = -1);
47
48 // internal constructors
49 clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v);
50 clifford(unsigned char rl, const ex & metr, int comm_sign, exvector && v);
51
52 // functions overriding virtual functions from base classes
53public:
54 unsigned precedence() const override { return 65; }
55 void archive(archive_node& n) const override;
56 void read_archive(const archive_node& n, lst& sym_lst) override;
57protected:
58 ex eval_ncmul(const exvector & v) const override;
59 bool match_same_type(const basic & other) const override;
60 ex thiscontainer(const exvector & v) const override;
61 ex thiscontainer(exvector && v) const override;
62 unsigned return_type() const override { return return_types::noncommutative; }
63 return_type_t return_type_tinfo() const override;
64 // non-virtual functions in this class
65public:
66 unsigned char get_representation_label() const { return representation_label; }
67 ex get_metric() const { return metric; }
68 virtual ex get_metric(const ex & i, const ex & j, bool symmetrised = false) const;
69 bool same_metric(const ex & other) const;
70 int get_commutator_sign() const { return commutator_sign; } //**< See the member variable commutator_sign */
71
72 inline size_t nops() const override {return inherited::nops() + 1; }
73 ex op(size_t i) const override;
74 ex & let_op(size_t i) override;
75 ex subs(const exmap & m, unsigned options = 0) const override;
76
77protected:
78 void do_print_dflt(const print_dflt & c, unsigned level) const;
79 void do_print_latex(const print_latex & c, unsigned level) const;
80 void do_print_tree(const print_tree & c, unsigned level) const;
81
82 // member variables
83protected:
84 unsigned char representation_label;
87};
89
91class diracone : public tensor
92{
94
95 // non-virtual functions in this class
96protected:
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
102
104class cliffordunit : public tensor
105{
107
108 // functions overriding virtual functions from base classes
109public:
110 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
111
112 // non-virtual functions in this class
113protected:
114 void do_print(const print_context & c, unsigned level) const;
115 void do_print_latex(const print_latex & c, unsigned level) const;
116};
118
119
122{
124
125 // functions overriding virtual functions from base classes
126public:
127 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
128
129 // non-virtual functions in this class
130protected:
131 void do_print(const print_context & c, unsigned level) const;
132 void do_print_latex(const print_latex & c, unsigned level) const;
133};
135
136
139class diracgamma5 : public tensor
140{
142
143 // functions overriding virtual functions from base classes
144 ex conjugate() const override;
145
146 // non-virtual functions in this class
147protected:
148 void do_print(const print_context & c, unsigned level) const;
149 void do_print_latex(const print_latex & c, unsigned level) const;
150};
152
153
156class diracgammaL : public tensor
157{
159
160 // functions overriding virtual functions from base classes
161 ex conjugate() const override;
162
163 // non-virtual functions in this class
164protected:
165 void do_print(const print_context & c, unsigned level) const;
166 void do_print_latex(const print_latex & c, unsigned level) const;
167};
169
170
173class diracgammaR : public tensor
174{
176
177 // functions overriding virtual functions from base classes
178 ex conjugate() const override;
179
180 // non-virtual functions in this class
181protected:
182 void do_print(const print_context & c, unsigned level) const;
183 void do_print_latex(const print_latex & c, unsigned level) const;
184};
186
187
188// global functions
189
194inline bool is_clifford_tinfo(const return_type_t& ti)
195{
196 return *(ti.tinfo) == typeid(clifford);
197}
198
203ex dirac_ONE(unsigned char rl = 0);
204
211ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0);
212
218ex dirac_gamma(const ex & mu, unsigned char rl = 0);
219
224ex dirac_gamma5(unsigned char rl = 0);
225
230ex dirac_gammaL(unsigned char rl = 0);
231
236ex dirac_gammaR(unsigned char rl = 0);
237
243ex dirac_slash(const ex & e, const ex & dim, unsigned char rl = 0);
244
253ex dirac_trace(const ex & e, const std::set<unsigned char> & rls, const ex & trONE = 4);
254
263ex dirac_trace(const ex & e, const lst & rll, const ex & trONE = 4);
264
274ex dirac_trace(const ex & e, unsigned char rl = 0, const ex & trONE = 4);
275
279ex canonicalize_clifford(const ex & e);
280
283ex clifford_prime(const ex & e);
284
286ex clifford_star_bar(const ex & e, bool do_bar, unsigned options);
287
290inline ex clifford_bar(const ex & e) { return clifford_star_bar(e, true, 0); }
291
294inline ex clifford_star(const ex & e) { return clifford_star_bar(e, false, 0); }
295
303ex remove_dirac_ONE(const ex & e, unsigned char rl = 0, unsigned options = 0);
304
310int clifford_max_label(const ex & e, bool ignore_ONE = false);
311
313ex clifford_norm(const ex & e);
314
316ex clifford_inverse(const ex & e);
317
325ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0);
326
332ex lst_to_clifford(const ex & v, const ex & e);
333
344lst clifford_to_lst(const ex & e, const ex & c, bool algebraic=true);
345
360ex clifford_moebius_map(const ex & a, const ex & b, const ex & c, const ex & d, const ex & v, const ex & G, unsigned char rl = 0);
361
370ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl = 0);
371
372} // namespace GiNaC
373
374#endif // ndef GINAC_CLIFFORD_H
#define GINAC_DECLARE_UNARCHIVER(classname)
Helper macros to register a class with (un)archiving (a.k.a.
Definition archive.h:219
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition archive.h:49
This class holds archived versions of GiNaC expressions (class ex).
Definition archive.h:255
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Definition basic.h:105
This class holds an object representing an element of the Clifford algebra (the Dirac gamma matrices)...
Definition clifford.h:41
ex get_metric() const
Definition clifford.h:67
unsigned char get_representation_label() const
Definition clifford.h:66
ex metric
Metric of the space, all constructors make it an indexed object.
Definition clifford.h:85
unsigned return_type() const override
Definition clifford.h:62
bool match_same_type(const basic &other) const override
Returns true if the attributes of two objects are similar enough for a match.
Definition clifford.cpp:248
bool same_metric(const ex &other) const
Definition clifford.cpp:178
void do_print_tree(const print_tree &c, unsigned level) const
Definition clifford.cpp:299
ex eval_ncmul(const exvector &v) const override
Perform automatic simplification on noncommutative product of clifford objects.
Definition clifford.cpp:530
void do_print_dflt(const print_dflt &c, unsigned level) const
Definition clifford.cpp:263
size_t nops() const override
Number of operands/members.
Definition clifford.h:72
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
Definition clifford.cpp:208
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition clifford.h:54
ex thiscontainer(const exvector &v) const override
Definition clifford.cpp:694
void do_print_latex(const print_latex &c, unsigned level) const
Definition clifford.cpp:286
ex subs(const exmap &m, unsigned options=0) const override
Substitute a set of objects by arbitrary expressions.
Definition clifford.cpp:220
ex op(size_t i) const override
Return operand/member at position i.
Definition clifford.cpp:199
int commutator_sign
It is the sign in the definition e~i e~j +/- e~j e~i = B(i, j) + B(j, i)
Definition clifford.h:86
return_type_t return_type_tinfo() const override
Definition clifford.cpp:118
unsigned char representation_label
Representation label to distinguish independent spin lines.
Definition clifford.h:84
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
Definition clifford.cpp:127
int get_commutator_sign() const
Definition clifford.h:70
This class represents the Clifford algebra generators (units).
Definition clifford.h:105
void do_print(const print_context &c, unsigned level) const
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of a Clifford unit with something else.
Definition clifford.cpp:463
void do_print_latex(const print_latex &c, unsigned level) const
Wrapper template for making GiNaC classes out of STL containers.
Definition container.h:73
This class represents the Dirac gamma5 object which anticommutates with all other gammas.
Definition clifford.h:140
ex conjugate() const override
Definition clifford.cpp:704
void do_print_latex(const print_latex &c, unsigned level) const
void do_print(const print_context &c, unsigned level) const
This class represents the Dirac gammaL object which behaves like 1/2 (1-gamma5).
Definition clifford.h:157
ex conjugate() const override
Definition clifford.cpp:709
void do_print_latex(const print_latex &c, unsigned level) const
void do_print(const print_context &c, unsigned level) const
This class represents the Dirac gammaL object which behaves like 1/2 (1+gamma5).
Definition clifford.h:174
ex conjugate() const override
Definition clifford.cpp:714
void do_print_latex(const print_latex &c, unsigned level) const
void do_print(const print_context &c, unsigned level) const
This class represents the Dirac gamma Lorentz vector.
Definition clifford.h:122
void do_print(const print_context &c, unsigned level) const
void do_print_latex(const print_latex &c, unsigned level) const
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of a gamma matrix with something else.
Definition clifford.cpp:352
This class represents the Clifford algebra unity element.
Definition clifford.h:92
void do_print(const print_context &c, unsigned level) const
void do_print_latex(const print_latex &c, unsigned level) const
Lightweight wrapper for GiNaC's symbolic objects.
Definition ex.h:73
This class holds an indexed expression.
Definition indexed.h:40
Base class for print_contexts.
Definition print.h:102
Context for default (ginsh-parsable) output.
Definition print.h:114
Context for latex-parsable output.
Definition print.h:122
Context for tree-like output for debugging.
Definition print.h:146
This class holds one of GiNaC's predefined special tensors such as the delta and the metric tensors.
Definition tensor.h:35
unsigned options
Definition factor.cpp:2474
size_t n
Definition factor.cpp:1432
size_t c
Definition factor.cpp:757
mvec m
Definition factor.cpp:758
Interface to GiNaC's indices.
Interface to GiNaC's indexed expressions.
Definition add.cpp:36
ex dirac_slash(const ex &e, const ex &dim, unsigned char rl)
Create a term of the form e_mu * gamma~mu with a unique index mu.
Definition clifford.cpp:812
ex remove_dirac_ONE(const ex &e, unsigned char rl, unsigned options)
Replaces dirac_ONE's (with a representation_label no less than rl) in e with 1.
bool is_clifford_tinfo(const return_type_t &ti)
Check whether a given return_type_t object (as returned by return_type_tinfo() is that of a clifford ...
Definition clifford.h:194
ex clifford_inverse(const ex &e)
Calculation of the inverse in the Clifford algebra.
ex dirac_gammaL(unsigned char rl)
Create a Dirac gammaL object.
Definition clifford.cpp:800
ex clifford_unit(const ex &mu, const ex &metr, unsigned char rl)
Create a Clifford unit object.
Definition clifford.cpp:740
container< std::list > lst
Definition lst.h:32
int clifford_max_label(const ex &e, bool ignore_ONE)
Returns the maximal representation label of a clifford object if e contains at least one,...
std::map< ex, ex, ex_is_less > exmap
Definition basic.h:50
ex clifford_star(const ex &e)
Reversion of the Clifford algebra, reverse the order of all clifford units in ncmul.
Definition clifford.h:294
ex clifford_moebius_map(const ex &a, const ex &b, const ex &c, const ex &d, const ex &v, const ex &G, unsigned char rl)
Calculations of Moebius transformations (conformal map) defined by a 2x2 Clifford matrix (a b\c d) in...
ex dirac_ONE(unsigned char rl)
Create a Clifford unity object.
Definition clifford.cpp:723
ex dirac_gamma(const ex &mu, unsigned char rl)
Create a Dirac gamma object.
Definition clifford.cpp:782
ex clifford_prime(const ex &e)
Automorphism of the Clifford algebra, simply changes signs of all clifford units.
ex dirac_gamma5(unsigned char rl)
Create a Dirac gamma5 object.
Definition clifford.cpp:794
ex clifford_bar(const ex &e)
Main anti-automorphism of the Clifford algebra: makes reversion and changes signs of all clifford uni...
Definition clifford.h:290
ex canonicalize_clifford(const ex &e_)
Bring all products of clifford objects in an expression into a canonical order.
ex clifford_star_bar(const ex &e, bool do_bar, unsigned options)
An auxillary function performing clifford_star() and clifford_bar().
ex clifford_norm(const ex &e)
Calculation of the norm in the Clifford algebra.
lst clifford_to_lst(const ex &e, const ex &c, bool algebraic)
An inverse function to lst_to_clifford().
ex dirac_trace(const ex &e, const std::set< unsigned char > &rls, const ex &trONE)
Calculate dirac traces over the specified set of representation labels.
Definition clifford.cpp:866
ex lst_to_clifford(const ex &v, const ex &mu, const ex &metr, unsigned char rl)
List or vector conversion into the Clifford vector.
std::vector< ex > exvector
Definition basic.h:48
ex dirac_gammaR(unsigned char rl)
Create a Dirac gammaR object.
Definition clifford.cpp:806
function G(const T1 &x, const T2 &y)
Definition inifcns.h:130
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition registrar.h:152
To distinguish between different kinds of non-commutative objects.
Definition registrar.h:43
std::type_info const * tinfo
to distinguish between non-commutative objects of different type.
Definition registrar.h:45
Interface to GiNaC's symbolic objects.
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.