|
GiNaC
1.6.2
|
00001 00005 /* 00006 * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef GINAC_CLIFFORD_H 00024 #define GINAC_CLIFFORD_H 00025 00026 #include "indexed.h" 00027 #include "tensor.h" 00028 #include "symbol.h" 00029 #include "idx.h" 00030 00031 #include <set> 00032 00033 namespace GiNaC { 00034 00040 class clifford : public indexed 00041 { 00042 GINAC_DECLARE_REGISTERED_CLASS(clifford, indexed) 00043 // other constructors 00044 public: 00045 clifford(const ex & b, unsigned char rl = 0); 00046 clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl = 0, int comm_sign = -1); 00047 00048 // internal constructors 00049 clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v, bool discardable = false); 00050 clifford(unsigned char rl, const ex & metr, int comm_sign, std::auto_ptr<exvector> vp); 00051 00052 // functions overriding virtual functions from base classes 00053 public: 00054 unsigned precedence() const { return 65; } 00055 void archive(archive_node& n) const; 00056 void read_archive(const archive_node& n, lst& sym_lst); 00057 protected: 00058 ex eval_ncmul(const exvector & v) const; 00059 bool match_same_type(const basic & other) const; 00060 ex thiscontainer(const exvector & v) const; 00061 ex thiscontainer(std::auto_ptr<exvector> vp) const; 00062 unsigned return_type() const { return return_types::noncommutative; } 00063 return_type_t return_type_tinfo() const; 00064 // non-virtual functions in this class 00065 public: 00066 unsigned char get_representation_label() const { return representation_label; } 00067 ex get_metric() const { return metric; } 00068 virtual ex get_metric(const ex & i, const ex & j, bool symmetrised = false) const; 00069 bool same_metric(const ex & other) const; 00070 int get_commutator_sign() const { return commutator_sign; } //**< See the member variable commutator_sign */ 00071 00072 inline size_t nops() const {return inherited::nops() + 1; } 00073 ex op(size_t i) const; 00074 ex & let_op(size_t i); 00075 ex subs(const exmap & m, unsigned options = 0) const; 00076 00077 protected: 00078 void do_print_dflt(const print_dflt & c, unsigned level) const; 00079 void do_print_latex(const print_latex & c, unsigned level) const; 00080 00081 // member variables 00082 protected: 00083 unsigned char representation_label; 00084 ex metric; 00085 int commutator_sign; 00086 }; 00087 GINAC_DECLARE_UNARCHIVER(clifford); 00088 00090 class diracone : public tensor 00091 { 00092 GINAC_DECLARE_REGISTERED_CLASS(diracone, tensor) 00093 00094 // non-virtual functions in this class 00095 protected: 00096 void do_print(const print_context & c, unsigned level) const; 00097 void do_print_latex(const print_latex & c, unsigned level) const; 00098 }; 00099 GINAC_DECLARE_UNARCHIVER(diracone); 00100 00101 00103 class cliffordunit : public tensor 00104 { 00105 GINAC_DECLARE_REGISTERED_CLASS(cliffordunit, tensor) 00106 00107 // functions overriding virtual functions from base classes 00108 public: 00109 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const; 00110 00111 // non-virtual functions in this class 00112 protected: 00113 void do_print(const print_context & c, unsigned level) const; 00114 void do_print_latex(const print_latex & c, unsigned level) const; 00115 }; 00116 00117 00119 class diracgamma : public cliffordunit 00120 { 00121 GINAC_DECLARE_REGISTERED_CLASS(diracgamma, cliffordunit) 00122 00123 // functions overriding virtual functions from base classes 00124 public: 00125 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const; 00126 00127 // non-virtual functions in this class 00128 protected: 00129 void do_print(const print_context & c, unsigned level) const; 00130 void do_print_latex(const print_latex & c, unsigned level) const; 00131 }; 00132 GINAC_DECLARE_UNARCHIVER(diracgamma); 00133 00134 00137 class diracgamma5 : public tensor 00138 { 00139 GINAC_DECLARE_REGISTERED_CLASS(diracgamma5, tensor) 00140 00141 // functions overriding virtual functions from base classes 00142 ex conjugate() const; 00143 00144 // non-virtual functions in this class 00145 protected: 00146 void do_print(const print_context & c, unsigned level) const; 00147 void do_print_latex(const print_latex & c, unsigned level) const; 00148 }; 00149 GINAC_DECLARE_UNARCHIVER(diracgamma5); 00150 00151 00154 class diracgammaL : public tensor 00155 { 00156 GINAC_DECLARE_REGISTERED_CLASS(diracgammaL, tensor) 00157 00158 // functions overriding virtual functions from base classes 00159 ex conjugate() const; 00160 00161 // non-virtual functions in this class 00162 protected: 00163 void do_print(const print_context & c, unsigned level) const; 00164 void do_print_latex(const print_latex & c, unsigned level) const; 00165 }; 00166 GINAC_DECLARE_UNARCHIVER(diracgammaL); 00167 00168 00171 class diracgammaR : public tensor 00172 { 00173 GINAC_DECLARE_REGISTERED_CLASS(diracgammaR, tensor) 00174 00175 // functions overriding virtual functions from base classes 00176 ex conjugate() const; 00177 00178 // non-virtual functions in this class 00179 protected: 00180 void do_print(const print_context & c, unsigned level) const; 00181 void do_print_latex(const print_latex & c, unsigned level) const; 00182 }; 00183 GINAC_DECLARE_UNARCHIVER(diracgammaR); 00184 00185 00186 // global functions 00187 00192 inline bool is_clifford_tinfo(const return_type_t& ti) 00193 { 00194 return *(ti.tinfo) == typeid(clifford); 00195 } 00196 00201 ex dirac_ONE(unsigned char rl = 0); 00202 00209 ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0); 00210 00216 ex dirac_gamma(const ex & mu, unsigned char rl = 0); 00217 00222 ex dirac_gamma5(unsigned char rl = 0); 00223 00228 ex dirac_gammaL(unsigned char rl = 0); 00229 00234 ex dirac_gammaR(unsigned char rl = 0); 00235 00241 ex dirac_slash(const ex & e, const ex & dim, unsigned char rl = 0); 00242 00251 ex dirac_trace(const ex & e, const std::set<unsigned char> & rls, const ex & trONE = 4); 00252 00261 ex dirac_trace(const ex & e, const lst & rll, const ex & trONE = 4); 00262 00272 ex dirac_trace(const ex & e, unsigned char rl = 0, const ex & trONE = 4); 00273 00277 ex canonicalize_clifford(const ex & e); 00278 00281 ex clifford_prime(const ex & e); 00282 00285 inline ex clifford_bar(const ex & e) { return clifford_prime(e.conjugate()); } 00286 00288 inline ex clifford_star(const ex & e) { return e.conjugate(); } 00289 00297 ex remove_dirac_ONE(const ex & e, unsigned char rl = 0, unsigned options = 0); 00298 00304 int clifford_max_label(const ex & e, bool ignore_ONE = false); 00305 00307 ex clifford_norm(const ex & e); 00308 00310 ex clifford_inverse(const ex & e); 00311 00320 ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0); 00321 ex lst_to_clifford(const ex & v, const ex & e); 00322 00333 lst clifford_to_lst(const ex & e, const ex & c, bool algebraic=true); 00334 00349 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 = 0); 00350 00359 ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl = 0); 00360 00361 } // namespace GiNaC 00362 00363 #endif // ndef GINAC_CLIFFORD_H