/[GiNaC]/ginac/clifford.h
ViewVC logotype

Contents of /ginac/clifford.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.53.2.1 - (hide annotations)
Thu Feb 10 00:00:24 2005 UTC (8 years, 4 months ago) by kreckel
Branch: ginac_1-3
Changes since 1.53: +10 -2 lines
File MIME type: text/plain
* clifford_moebius_map: honor representation label (Vladimir Kisil).

1 cbauer 1.1 /** @file clifford.h
2     *
3 cbauer 1.22 * Interface to GiNaC's clifford algebra (Dirac gamma) objects. */
4 cbauer 1.4
5     /*
6 vollinga 1.46 * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
7 cbauer 1.2 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21     */
22 cbauer 1.1
23 cbauer 1.2 #ifndef __GINAC_CLIFFORD_H__
24     #define __GINAC_CLIFFORD_H__
25 cbauer 1.1
26 cbauer 1.22 #include "indexed.h"
27     #include "tensor.h"
28 vollinga 1.47 #include "symbol.h"
29     #include "idx.h"
30 cbauer 1.5
31 cbauer 1.51 #include <set>
32    
33 cbauer 1.5 namespace GiNaC {
34 cbauer 1.1
35 cbauer 1.15
36     /** This class holds an object representing an element of the Clifford
37     * algebra (the Dirac gamma matrices). These objects only carry Lorentz
38 cbauer 1.25 * indices. Spinor indices are hidden. A representation label (an unsigned
39     * 8-bit integer) is used to distinguish elements from different Clifford
40 cbauer 1.50 * algebras (objects with different labels commutate). */
41 cbauer 1.22 class clifford : public indexed
42 cbauer 1.1 {
43 cbauer 1.22 GINAC_DECLARE_REGISTERED_CLASS(clifford, indexed)
44 cbauer 1.15
45 cbauer 1.12 // other constructors
46 cbauer 1.1 public:
47 cbauer 1.25 clifford(const ex & b, unsigned char rl = 0);
48 vollinga 1.47 clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl = 0);
49 cbauer 1.22
50     // internal constructors
51 cbauer 1.48 clifford(unsigned char rl, const ex & metr, const exvector & v, bool discardable = false);
52     clifford(unsigned char rl, const ex & metr, std::auto_ptr<exvector> vp);
53 cbauer 1.1
54 cbauer 1.12 // functions overriding virtual functions from base classes
55 cbauer 1.1 protected:
56 cbauer 1.42 ex eval_ncmul(const exvector & v) const;
57 cbauer 1.35 bool match_same_type(const basic & other) const;
58 cbauer 1.42 ex thiscontainer(const exvector & v) const;
59 cbauer 1.44 ex thiscontainer(std::auto_ptr<exvector> vp) const;
60 cbauer 1.42 unsigned return_type() const { return return_types::noncommutative; }
61     unsigned return_type_tinfo() const { return TINFO_clifford + representation_label; }
62 cbauer 1.25
63 cbauer 1.26 // non-virtual functions in this class
64     public:
65 cbauer 1.48 unsigned char get_representation_label() const { return representation_label; }
66     ex get_metric() const { return metric; }
67     ex get_metric(const ex & i, const ex & j) const;
68     bool same_metric(const ex & other) const;
69 cbauer 1.26
70 cbauer 1.43 protected:
71     void do_print_dflt(const print_dflt & c, unsigned level) const;
72     void do_print_latex(const print_latex & c, unsigned level) const;
73    
74 cbauer 1.25 // member variables
75     private:
76     unsigned char representation_label; /**< Representation label to distinguish independent spin lines */
77 cbauer 1.48 ex metric;
78 cbauer 1.22 };
79    
80 cbauer 1.1
81 cbauer 1.23 /** This class represents the Clifford algebra unity element. */
82     class diracone : public tensor
83     {
84     GINAC_DECLARE_REGISTERED_CLASS(diracone, tensor)
85    
86 cbauer 1.43 // non-virtual functions in this class
87     protected:
88     void do_print(const print_context & c, unsigned level) const;
89     void do_print_latex(const print_latex & c, unsigned level) const;
90 cbauer 1.23 };
91    
92    
93 vollinga 1.47 /** This class represents the Clifford algebra generators (units). */
94     class cliffordunit : public tensor
95     {
96     GINAC_DECLARE_REGISTERED_CLASS(cliffordunit, tensor)
97    
98 cbauer 1.48 // other constructors
99 vollinga 1.47 protected:
100 cbauer 1.48 cliffordunit(unsigned ti) : inherited(ti) {}
101 vollinga 1.47
102     // functions overriding virtual functions from base classes
103     public:
104     bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
105 cbauer 1.48
106 vollinga 1.47 // non-virtual functions in this class
107     protected:
108     void do_print(const print_context & c, unsigned level) const;
109     void do_print_latex(const print_latex & c, unsigned level) const;
110     };
111    
112    
113 cbauer 1.22 /** This class represents the Dirac gamma Lorentz vector. */
114 vollinga 1.47 class diracgamma : public cliffordunit
115 cbauer 1.22 {
116 vollinga 1.47 GINAC_DECLARE_REGISTERED_CLASS(diracgamma, cliffordunit)
117 cbauer 1.1
118 cbauer 1.36 // functions overriding virtual functions from base classes
119 cbauer 1.22 public:
120 cbauer 1.23 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
121 cbauer 1.43
122     // non-virtual functions in this class
123     protected:
124     void do_print(const print_context & c, unsigned level) const;
125     void do_print_latex(const print_latex & c, unsigned level) const;
126 cbauer 1.1 };
127    
128 cbauer 1.22
129 cbauer 1.50 /** This class represents the Dirac gamma5 object which anticommutates with
130 cbauer 1.28 * all other gammas. */
131 cbauer 1.25 class diracgamma5 : public tensor
132     {
133     GINAC_DECLARE_REGISTERED_CLASS(diracgamma5, tensor)
134    
135 vollinga 1.46 // functions overriding virtual functions from base classes
136     ex conjugate() const;
137    
138 cbauer 1.43 // non-virtual functions in this class
139     protected:
140     void do_print(const print_context & c, unsigned level) const;
141     void do_print_latex(const print_latex & c, unsigned level) const;
142 cbauer 1.25 };
143    
144    
145 cbauer 1.40 /** This class represents the Dirac gammaL object which behaves like
146     * 1/2 (1-gamma5). */
147     class diracgammaL : public tensor
148     {
149     GINAC_DECLARE_REGISTERED_CLASS(diracgammaL, tensor)
150    
151 vollinga 1.46 // functions overriding virtual functions from base classes
152     ex conjugate() const;
153    
154 cbauer 1.43 // non-virtual functions in this class
155     protected:
156     void do_print(const print_context & c, unsigned level) const;
157     void do_print_latex(const print_latex & c, unsigned level) const;
158 cbauer 1.40 };
159    
160    
161     /** This class represents the Dirac gammaL object which behaves like
162     * 1/2 (1+gamma5). */
163     class diracgammaR : public tensor
164     {
165     GINAC_DECLARE_REGISTERED_CLASS(diracgammaR, tensor)
166 vollinga 1.46
167     // functions overriding virtual functions from base classes
168     ex conjugate() const;
169 cbauer 1.40
170 cbauer 1.43 // non-virtual functions in this class
171     protected:
172     void do_print(const print_context & c, unsigned level) const;
173     void do_print_latex(const print_latex & c, unsigned level) const;
174 cbauer 1.40 };
175    
176    
177 cbauer 1.15 // global functions
178 kreckel 1.33
179     /** Specialization of is_exactly_a<clifford>(obj) for clifford objects. */
180     template<> inline bool is_exactly_a<clifford>(const basic & obj)
181     {
182     return obj.tinfo()==TINFO_clifford;
183     }
184 cbauer 1.23
185     /** Create a Clifford unity object.
186     *
187 cbauer 1.25 * @param rl Representation label
188 cbauer 1.23 * @return newly constructed object */
189 cbauer 1.25 ex dirac_ONE(unsigned char rl = 0);
190 cbauer 1.22
191 vollinga 1.47 /** Create a Clifford unit object.
192     *
193     * @param mu Index (must be of class varidx or a derived class)
194 cbauer 1.49 * @param metr Metric (should be of class tensmetric or a derived class, or a symmetric matrix)
195 vollinga 1.47 * @param rl Representation label
196     * @return newly constructed Clifford unit object */
197     ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0);
198    
199 cbauer 1.22 /** Create a Dirac gamma object.
200     *
201     * @param mu Index (must be of class varidx or a derived class)
202 cbauer 1.25 * @param rl Representation label
203 cbauer 1.22 * @return newly constructed gamma object */
204 cbauer 1.25 ex dirac_gamma(const ex & mu, unsigned char rl = 0);
205    
206     /** Create a Dirac gamma5 object.
207     *
208     * @param rl Representation label
209     * @return newly constructed object */
210     ex dirac_gamma5(unsigned char rl = 0);
211 cbauer 1.26
212 cbauer 1.40 /** Create a Dirac gammaL object.
213     *
214     * @param rl Representation label
215     * @return newly constructed object */
216     ex dirac_gammaL(unsigned char rl = 0);
217    
218     /** Create a Dirac gammaR object.
219     *
220     * @param rl Representation label
221     * @return newly constructed object */
222     ex dirac_gammaR(unsigned char rl = 0);
223 cbauer 1.29
224 cbauer 1.28 /** Create a term of the form e_mu * gamma~mu with a unique index mu.
225     *
226 cbauer 1.45 * @param e Original expression
227 cbauer 1.28 * @param dim Dimension of index
228     * @param rl Representation label */
229     ex dirac_slash(const ex & e, const ex & dim, unsigned char rl = 0);
230    
231 cbauer 1.51 /** Calculate dirac traces over the specified set of representation labels.
232     * The computed trace is a linear functional that is equal to the usual
233     * trace only in D = 4 dimensions. In particular, the functional is not
234     * always cyclic in D != 4 dimensions when gamma5 is involved.
235     *
236     * @param e Expression to take the trace of
237     * @param rls Set of representation labels
238     * @param trONE Expression to be returned as the trace of the unit matrix */
239     ex dirac_trace(const ex & e, const std::set<unsigned char> & rls, const ex & trONE = 4);
240    
241     /** Calculate dirac traces over the specified list of representation labels.
242     * The computed trace is a linear functional that is equal to the usual
243     * trace only in D = 4 dimensions. In particular, the functional is not
244     * always cyclic in D != 4 dimensions when gamma5 is involved.
245     *
246     * @param e Expression to take the trace of
247     * @param rll List of representation labels
248     * @param trONE Expression to be returned as the trace of the unit matrix */
249     ex dirac_trace(const ex & e, const lst & rll, const ex & trONE = 4);
250    
251 cbauer 1.26 /** Calculate the trace of an expression containing gamma objects with
252 cbauer 1.27 * a specified representation label. The computed trace is a linear
253     * functional that is equal to the usual trace only in D = 4 dimensions.
254 cbauer 1.28 * In particular, the functional is not always cyclic in D != 4 dimensions
255     * when gamma5 is involved.
256 cbauer 1.26 *
257 cbauer 1.30 * @param e Expression to take the trace of
258     * @param rl Representation label
259     * @param trONE Expression to be returned as the trace of the unit matrix */
260     ex dirac_trace(const ex & e, unsigned char rl = 0, const ex & trONE = 4);
261 cbauer 1.22
262 cbauer 1.31 /** Bring all products of clifford objects in an expression into a canonical
263     * order. This is not necessarily the most simple form but it will allow
264 cbauer 1.32 * to check two expressions for equality. */
265 cbauer 1.31 ex canonicalize_clifford(const ex & e);
266 vollinga 1.47
267 cbauer 1.48 /** Automorphism of the Clifford algebra, simply changes signs of all
268 vollinga 1.47 * clifford units. */
269 cbauer 1.48 ex clifford_prime(const ex & e);
270 vollinga 1.47
271 cbauer 1.48 /** Main anti-automorphism of the Clifford algebra: makes reversion
272     * and changes signs of all clifford units. */
273     inline ex clifford_bar(const ex & e) { return clifford_prime(e.conjugate()); }
274 vollinga 1.47
275 cbauer 1.48 /** Reversion of the Clifford algebra, coincides with the conjugate(). */
276     inline ex clifford_star(const ex & e) { return e.conjugate(); }
277 vollinga 1.47
278 vollinga 1.52 /** Replaces all dirac_ONE's in e with 1 (effectively removing them). */
279     ex remove_dirac_ONE(const ex & e);
280 vollinga 1.47
281 cbauer 1.48 /** Calculation of the norm in the Clifford algebra. */
282     ex clifford_norm(const ex & e);
283 vollinga 1.47
284 cbauer 1.48 /** Calculation of the inverse in the Clifford algebra. */
285     ex clifford_inverse(const ex & e);
286 vollinga 1.47
287 cbauer 1.48 /** List or vector conversion into the Clifford vector.
288     *
289 vollinga 1.47 * @param v List or vector of coordinates
290     * @param mu Index (must be of class varidx or a derived class)
291 cbauer 1.49 * @param metr Metric (should be of class tensmetric or a derived class, or a symmetric matrix)
292 vollinga 1.47 * @param rl Representation label
293     * @return Clifford vector with given components */
294 cbauer 1.48 ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0);
295 cbauer 1.1
296 vollinga 1.52 /** An inverse function to lst_to_clifford(). For given Clifford vector extracts
297     * its components with respect to given Clifford unit. Obtained components may
298     * contain Clifford units with a different metric. Extraction is based on
299     * the algebraic formula (e * c.i + c.i * e)/ pow(e.i, 2) for non-degenerate cases
300     * (i.e. neither pow(e.i, 2) = 0).
301     *
302     * @param e Clifford expression to be decomposed into components
303     * @param c Clifford unit defining the metric for splitting (should have numeric dimension of indices)
304     * @param algebraic Use algebraic or symbolic algorithm for extractions */
305     lst clifford_to_lst(const ex & e, const ex & c, bool algebraic=true);
306    
307     /** Calculations of Moebius transformations (conformal map) defined by a 2x2 Clifford matrix
308     * (a b\\c d) in linear spaces with arbitrary signature. The expression is
309     * (a * x + b)/(c * x + d), where x is a vector build from list v with metric G.
310     * (see Jan Cnops. An introduction to {D}irac operators on manifolds, v.24 of
311     * Progress in Mathematical Physics. Birkhauser Boston Inc., Boston, MA, 2002.)
312     *
313     * @param a (1,1) entry of the defining matrix
314     * @param b (1,2) entry of the defining matrix
315     * @param c (2,1) entry of the defining matrix
316     * @param d (2,2) entry of the defining matrix
317     * @param v Vector to be transformed
318 kreckel 1.53.2.1 * @param G Metric of the surrounding space
319     * @param rl Representation label */
320     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);
321    
322     /** Same as clifford_moebius_map(a, b, c, d, v, G, 0). */
323 vollinga 1.52 ex clifford_moebius_map(const ex & a, const ex & b, const ex & c, const ex & d, const ex & v, const ex & G);
324 vollinga 1.53
325     /** The second form of Moebius transformations defined by a 2x2 Clifford matrix M
326     * This function takes the transformation matrix M as a single entity.
327     *
328     * @param M the defining matrix
329     * @param v Vector to be transformed
330 kreckel 1.53.2.1 * @param G Metric of the surrounding space
331     * @param rl Representation label */
332     ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl);
333    
334     /** Same as clifford_moebius_map(M, v, G, 0). */
335 vollinga 1.53 ex clifford_moebius_map(const ex & M, const ex & v, const ex & G);
336    
337 cbauer 1.5 } // namespace GiNaC
338 cbauer 1.1
339 cbauer 1.2 #endif // ndef __GINAC_CLIFFORD_H__

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15