| 24 |
#define __GINAC_CLIFFORD_H__ |
#define __GINAC_CLIFFORD_H__ |
| 25 |
|
|
| 26 |
#include <string> |
#include <string> |
| 27 |
#include "indexed.h" |
#include "lortensor.h" |
|
#include "ex.h" |
|
| 28 |
|
|
| 29 |
#ifndef NO_NAMESPACE_GINAC |
#ifndef NO_NAMESPACE_GINAC |
| 30 |
namespace GiNaC { |
namespace GiNaC { |
| 31 |
#endif // ndef NO_NAMESPACE_GINAC |
#endif // ndef NO_NAMESPACE_GINAC |
| 32 |
|
|
| 33 |
/** Base class for clifford object */ |
|
| 34 |
class clifford : public indexed |
/** This class holds an object representing an element of the Clifford |
| 35 |
|
* algebra (the Dirac gamma matrices). These objects only carry Lorentz |
| 36 |
|
* indices. Spinor indices are always hidden in our implementation. */ |
| 37 |
|
class clifford : public lortensor |
| 38 |
{ |
{ |
| 39 |
|
GINAC_DECLARE_REGISTERED_CLASS(clifford, lortensor) |
| 40 |
|
|
| 41 |
|
// friends |
| 42 |
|
|
| 43 |
|
friend clifford clifford_gamma(const ex & mu); |
| 44 |
|
|
| 45 |
// member functions |
// member functions |
| 46 |
|
|
| 47 |
// default constructor, destructor, copy constructor assignment operator and helpers |
// default constructor, destructor, copy constructor assignment operator and helpers |
| 56 |
|
|
| 57 |
// other constructors |
// other constructors |
| 58 |
public: |
public: |
| 59 |
explicit clifford(const std::string & initname); |
clifford(const std::string & n, const ex & mu); |
| 60 |
|
|
| 61 |
// functions overriding virtual functions from base classes |
// functions overriding virtual functions from base classes |
| 62 |
public: |
public: |
| 64 |
void printraw(std::ostream & os) const; |
void printraw(std::ostream & os) const; |
| 65 |
void printtree(std::ostream & os, unsigned indent) const; |
void printtree(std::ostream & os, unsigned indent) const; |
| 66 |
void print(std::ostream & os, unsigned upper_precedence=0) const; |
void print(std::ostream & os, unsigned upper_precedence=0) const; |
|
void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const; |
|
| 67 |
bool info(unsigned inf) const; |
bool info(unsigned inf) const; |
| 68 |
|
// ex eval(int level=0) const; |
| 69 |
protected: |
protected: |
| 70 |
int compare_same_type(const basic & other) const; |
int compare_same_type(const basic & other) const; |
| 71 |
|
bool is_equal_same_type(const basic & other) const; |
| 72 |
ex simplify_ncmul(const exvector & v) const; |
ex simplify_ncmul(const exvector & v) const; |
| 73 |
unsigned calchash(void) const; |
ex thisexprseq(const exvector & v) const; |
| 74 |
|
ex thisexprseq(exvector * vp) const; |
| 75 |
|
|
| 76 |
// new virtual functions which can be overridden by derived classes |
// new virtual functions which can be overridden by derived classes |
| 77 |
// none |
// none |
| 78 |
|
|
| 79 |
// non-virtual functions in this class |
// non-virtual functions in this class |
| 80 |
public: |
// none |
|
void setname(const std::string & n); |
|
|
private: |
|
|
std::string & autoname_prefix(void); |
|
| 81 |
|
|
| 82 |
// member variables |
// member variables |
| 83 |
|
// none |
|
protected: |
|
|
std::string name; |
|
|
unsigned serial; // unique serial number for comparision |
|
|
private: |
|
|
static unsigned next_serial; |
|
| 84 |
}; |
}; |
| 85 |
|
|
| 86 |
// global constants |
// global constants |
| 88 |
extern const clifford some_clifford; |
extern const clifford some_clifford; |
| 89 |
extern const std::type_info & typeid_clifford; |
extern const std::type_info & typeid_clifford; |
| 90 |
|
|
| 91 |
// utility functions |
// global functions |
| 92 |
inline const clifford &ex_to_clifford(const ex &e) |
inline const clifford &ex_to_clifford(const ex &e) |
| 93 |
{ |
{ |
| 94 |
return static_cast<const clifford &>(*e.bp); |
return static_cast<const clifford &>(*e.bp); |
| 95 |
} |
} |
| 96 |
|
|
| 97 |
|
clifford clifford_gamma(const ex & mu); |
| 98 |
|
|
| 99 |
#ifndef NO_NAMESPACE_GINAC |
#ifndef NO_NAMESPACE_GINAC |
| 100 |
} // namespace GiNaC |
} // namespace GiNaC |
| 101 |
#endif // ndef NO_NAMESPACE_GINAC |
#endif // ndef NO_NAMESPACE_GINAC |