3 * Interface to GiNaC's clifford algebra (Dirac gamma) objects. */
6 * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
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.
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.
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
23 #ifndef __GINAC_CLIFFORD_H__
24 #define __GINAC_CLIFFORD_H__
32 /** This class holds an object representing an element of the Clifford
33 * algebra (the Dirac gamma matrices). These objects only carry Lorentz
34 * indices. Spinor indices are hidden. A representation label (an unsigned
35 * 8-bit integer) is used to distinguish elements from different Clifford
36 * algebras (objects with different labels commute). */
37 class clifford : public indexed
39 GINAC_DECLARE_REGISTERED_CLASS(clifford, indexed)
43 clifford(const ex & b, unsigned char rl = 0);
44 clifford(const ex & b, const ex & mu, unsigned char rl = 0);
46 // internal constructors
47 clifford(unsigned char rl, const exvector & v, bool discardable = false);
48 clifford(unsigned char rl, exvector * vp); // vp will be deleted
50 // functions overriding virtual functions from base classes
52 ex simplify_ncmul(const exvector & v) const;
53 ex thisexprseq(const exvector & v) const;
54 ex thisexprseq(exvector * vp) const;
55 unsigned return_type(void) const { return return_types::noncommutative; }
56 unsigned return_type_tinfo(void) const { return TINFO_clifford + representation_label; }
60 unsigned char representation_label; /**< Representation label to distinguish independent spin lines */
64 /** This class represents the Clifford algebra unity element. */
65 class diracone : public tensor
67 GINAC_DECLARE_REGISTERED_CLASS(diracone, tensor)
69 // functions overriding virtual functions from bases classes
71 void print(const print_context & c, unsigned level = 0) const;
75 /** This class represents the Dirac gamma Lorentz vector. */
76 class diracgamma : public tensor
78 GINAC_DECLARE_REGISTERED_CLASS(diracgamma, tensor)
80 // functions overriding virtual functions from bases classes
82 void print(const print_context & c, unsigned level = 0) const;
83 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
87 /** This class represents the Dirac gamma5 object. */
88 class diracgamma5 : public tensor
90 GINAC_DECLARE_REGISTERED_CLASS(diracgamma5, tensor)
92 // functions overriding virtual functions from bases classes
94 void print(const print_context & c, unsigned level = 0) const;
99 inline const clifford &ex_to_clifford(const ex &e)
101 return static_cast<const clifford &>(*e.bp);
105 /** Create a Clifford unity object.
107 * @param rl Representation label
108 * @return newly constructed object */
109 ex dirac_ONE(unsigned char rl = 0);
111 /** Create a Dirac gamma object.
113 * @param mu Index (must be of class varidx or a derived class)
114 * @param rl Representation label
115 * @return newly constructed gamma object */
116 ex dirac_gamma(const ex & mu, unsigned char rl = 0);
118 /** Create a Dirac gamma5 object.
120 * @param rl Representation label
121 * @return newly constructed object */
122 ex dirac_gamma5(unsigned char rl = 0);
127 #endif // ndef __GINAC_CLIFFORD_H__