GiNaC 1.8.10
clifford.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_CLIFFORD_H
23#define GINAC_CLIFFORD_H
24
25#include "indexed.h"
26#include "tensor.h"
27#include "symbol.h"
28#include "idx.h"
29
30#include <set>
31
32namespace GiNaC {
33
39class clifford : public indexed
40{
42 // other constructors
43public:
44 clifford(const ex & b, unsigned char rl = 0);
45 clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl = 0, int comm_sign = -1);
46
47 // internal constructors
48 clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v);
49 clifford(unsigned char rl, const ex & metr, int comm_sign, exvector && v);
50
51 // functions overriding virtual functions from base classes
52public:
53 unsigned precedence() const override { return 65; }
54 void archive(archive_node& n) const override;
55 void read_archive(const archive_node& n, lst& sym_lst) override;
56protected:
57 ex eval_ncmul(const exvector & v) const override;
58 bool match_same_type(const basic & other) const override;
59 ex thiscontainer(const exvector & v) const override;
60 ex thiscontainer(exvector && v) const override;
61 unsigned return_type() const override { return return_types::noncommutative; }
62 return_type_t return_type_tinfo() const override;
63 // non-virtual functions in this class
64public:
65 unsigned char get_representation_label() const { return representation_label; }
66 ex get_metric() const { return metric; }
67 virtual ex get_metric(const ex & i, const ex & j, bool symmetrised = false) const;
68 bool same_metric(const ex & other) const;
69 int get_commutator_sign() const { return commutator_sign; } //**< See the member variable commutator_sign */
70
71 inline size_t nops() const override {return inherited::nops() + 1; }
72 ex op(size_t i) const override;
73 ex & let_op(size_t i) override;
74 ex subs(const exmap & m, unsigned options = 0) const override;
75
76protected:
77 void do_print_dflt(const print_dflt & c, unsigned level) const;
78 void do_print_latex(const print_latex & c, unsigned level) const;
79 void do_print_tree(const print_tree & c, unsigned level) const;
80
81 // member variables
82protected:
83 unsigned char representation_label;
86};
88
90class diracone : public tensor
91{
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
101
103class cliffordunit : public tensor
104{
106
107 // functions overriding virtual functions from base classes
108public:
109 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
110
111 // non-virtual functions in this class
112protected:
113 void do_print(const print_context & c, unsigned level) const;
114 void do_print_latex(const print_latex & c, unsigned level) const;
115};
117
118
121{
123
124 // functions overriding virtual functions from base classes
125public:
126 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const override;
127
128 // non-virtual functions in this class
129protected:
130 void do_print(const print_context & c, unsigned level) const;
131 void do_print_latex(const print_latex & c, unsigned level) const;
132};
134
135
138class diracgamma5 : public tensor
139{
141
142 // functions overriding virtual functions from base classes
143 ex conjugate() const override;
144
145 // non-virtual functions in this class
146protected:
147 void do_print(const print_context & c, unsigned level) const;
148 void do_print_latex(const print_latex & c, unsigned level) const;
149};
151
152
155class diracgammaL : public tensor
156{
158
159 // functions overriding virtual functions from base classes
160 ex conjugate() const override;
161
162 // non-virtual functions in this class
163protected:
164 void do_print(const print_context & c, unsigned level) const;
165 void do_print_latex(const print_latex & c, unsigned level) const;
166};
168
169
172class diracgammaR : public tensor
173{
175
176 // functions overriding virtual functions from base classes
177 ex conjugate() const override;
178
179 // non-virtual functions in this class
180protected:
181 void do_print(const print_context & c, unsigned level) const;
182 void do_print_latex(const print_latex & c, unsigned level) const;
183};
185
186
187// global functions
188
193inline bool is_clifford_tinfo(const return_type_t& ti)
194{
195 return *(ti.tinfo) == typeid(clifford);
196}
197
202ex dirac_ONE(unsigned char rl = 0);
203
210ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0);
211
217ex dirac_gamma(const ex & mu, unsigned char rl = 0);
218
223ex dirac_gamma5(unsigned char rl = 0);
224
229ex dirac_gammaL(unsigned char rl = 0);
230
235ex dirac_gammaR(unsigned char rl = 0);
236
242ex dirac_slash(const ex & e, const ex & dim, unsigned char rl = 0);
243
252ex dirac_trace(const ex & e, const std::set<unsigned char> & rls, const ex & trONE = 4);
253
262ex dirac_trace(const ex & e, const lst & rll, const ex & trONE = 4);
263
273ex dirac_trace(const ex & e, unsigned char rl = 0, const ex & trONE = 4);
274
278ex canonicalize_clifford(const ex & e);
279
282ex clifford_prime(const ex & e);
283
285ex clifford_star_bar(const ex & e, bool do_bar, unsigned options);
286
289inline ex clifford_bar(const ex & e) { return clifford_star_bar(e, true, 0); }
290
293inline ex clifford_star(const ex & e) { return clifford_star_bar(e, false, 0); }
294
302ex remove_dirac_ONE(const ex & e, unsigned char rl = 0, unsigned options = 0);
303
309int clifford_max_label(const ex & e, bool ignore_ONE = false);
310
312ex clifford_norm(const ex & e);
313
315ex clifford_inverse(const ex & e);
316
324ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0);
325
331ex lst_to_clifford(const ex & v, const ex & e);
332
343lst clifford_to_lst(const ex & e, const ex & c, bool algebraic=true);
344
359ex 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);
360
369ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl = 0);
370
371} // namespace GiNaC
372
373#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: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 an object representing an element of the Clifford algebra (the Dirac gamma matrices)...
Definition clifford.h:40
ex get_metric() const
Definition clifford.h:66
unsigned char get_representation_label() const
Definition clifford.h:65
ex metric
Metric of the space, all constructors make it an indexed object.
Definition clifford.h:84
unsigned return_type() const override
Definition clifford.h:61
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:247
bool same_metric(const ex &other) const
Definition clifford.cpp:177
void do_print_tree(const print_tree &c, unsigned level) const
Definition clifford.cpp:298
ex eval_ncmul(const exvector &v) const override
Perform automatic simplification on noncommutative product of clifford objects.
Definition clifford.cpp:529
void do_print_dflt(const print_dflt &c, unsigned level) const
Definition clifford.cpp:262
size_t nops() const override
Number of operands/members.
Definition clifford.h:71
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
Definition clifford.cpp:207
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition clifford.h:53
ex thiscontainer(const exvector &v) const override
Definition clifford.cpp:693
void do_print_latex(const print_latex &c, unsigned level) const
Definition clifford.cpp:285
ex subs(const exmap &m, unsigned options=0) const override
Substitute a set of objects by arbitrary expressions.
Definition clifford.cpp:219
ex op(size_t i) const override
Return operand/member at position i.
Definition clifford.cpp:198
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:85
return_type_t return_type_tinfo() const override
Definition clifford.cpp:117
unsigned char representation_label
Representation label to distinguish independent spin lines.
Definition clifford.h:83
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
Definition clifford.cpp:126
int get_commutator_sign() const
Definition clifford.h:69
This class represents the Clifford algebra generators (units).
Definition clifford.h:104
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:462
void do_print_latex(const print_latex &c, unsigned level) const
Wrapper template for making GiNaC classes out of STL containers.
Definition container.h:72
This class represents the Dirac gamma5 object which anticommutates with all other gammas.
Definition clifford.h:139
ex conjugate() const override
Definition clifford.cpp:703
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:156
ex conjugate() const override
Definition clifford.cpp:708
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:173
ex conjugate() const override
Definition clifford.cpp:713
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:121
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:351
This class represents the Clifford algebra unity element.
Definition clifford.h:91
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:72
This class holds an indexed expression.
Definition indexed.h:39
Base class for print_contexts.
Definition print.h:101
Context for default (ginsh-parsable) output.
Definition print.h:113
Context for latex-parsable output.
Definition print.h:121
Context for tree-like output for debugging.
Definition print.h:145
This class holds one of GiNaC's predefined special tensors such as the delta and the metric tensors.
Definition tensor.h:34
unsigned options
Definition factor.cpp:2473
size_t n
Definition factor.cpp:1431
size_t c
Definition factor.cpp:756
mvec m
Definition factor.cpp:757
Interface to GiNaC's indices.
Interface to GiNaC's indexed expressions.
Definition add.cpp:35
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:811
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:193
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:799
ex clifford_unit(const ex &mu, const ex &metr, unsigned char rl)
Create a Clifford unit object.
Definition clifford.cpp:739
container< std::list > lst
Definition lst.h:31
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:49
ex clifford_star(const ex &e)
Reversion of the Clifford algebra, reverse the order of all clifford units in ncmul.
Definition clifford.h:293
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:722
ex dirac_gamma(const ex &mu, unsigned char rl)
Create a Dirac gamma object.
Definition clifford.cpp:781
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:793
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:289
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:865
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:47
ex dirac_gammaR(unsigned char rl)
Create a Dirac gammaR object.
Definition clifford.cpp:805
function G(const T1 &x, const T2 &y)
Definition inifcns.h:129
#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
std::type_info const * tinfo
to distinguish between non-commutative objects of different type.
Definition registrar.h:44
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.