3 * Interface to GiNaC's simp_lor objects. */
17 #include "lorentzidx.h"
19 typedef pair<string,string> strstrpair;
20 typedef pair<strstrpair,lorentzidx> spmapkey;
22 class spmapkey_is_less
25 bool operator()(spmapkey const & lh, spmapkey const & rh) const
28 cerr << "spmapkey_is_less" << endl;
29 cerr << "lh=((" << lh.first.first
30 << "," << lh.first.second << "),";
31 lh.second.printraw(cerr);
34 cerr << "rh=((" << rh.first.first
35 << "," << rh.first.second << "),";
36 rh.second.printraw(cerr);
39 bool res=lh.first<rh.first ||
40 (!(rh.first<lh.first) && lh.second.compare(rh.second)<0 );
41 // cout << "result=" << res << endl;
46 typedef map<spmapkey,ex,spmapkey_is_less> spmap;
50 /** helper class for scalar products */
54 void reg(simp_lor const & v1, simp_lor const & v2, ex const & sp);
55 bool is_defined(simp_lor const & v1, simp_lor const & v2) const;
56 ex evaluate(simp_lor const & v1, simp_lor const & v2) const;
57 void debugprint(void) const;
59 static spmapkey make_key(simp_lor const & v1, simp_lor const & v2);
64 /** Base class for simp_lor object */
65 class simp_lor : public indexed
69 friend class scalar_products;
70 friend simp_lor lor_g(ex const & mu, ex const & nu);
71 friend simp_lor lor_vec(string const & n, ex const & mu);
72 friend ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp);
73 friend ex simplify_simp_lor(ex const & e, scalar_products const & sp);
78 typedef enum { invalid, // not properly constructed by one of the friend functions
85 // default constructor, destructor, copy constructor assignment operator and helpers
89 simp_lor(simp_lor const & other);
90 simp_lor const & operator=(simp_lor const & other);
92 void copy(simp_lor const & other);
93 void destroy(bool call_parent);
97 simp_lor(simp_lor_types const t);
98 simp_lor(simp_lor_types const t, ex const & i1, ex const & i2);
99 simp_lor(simp_lor_types const t, string const & n, ex const & i1);
100 simp_lor(simp_lor_types const t, string const & n, exvector const & iv);
101 simp_lor(simp_lor_types const t, string const & n, exvector * ivp);
103 // functions overriding virtual functions from base classes
105 basic * duplicate() const;
106 void printraw(ostream & os) const;
107 void printtree(ostream & os, unsigned indent) const;
108 void print(ostream & os, unsigned upper_precedence=0) const;
109 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
110 bool info(unsigned inf) const;
111 ex eval(int level=0) const;
113 int compare_same_type(basic const & other) const;
114 bool is_equal_same_type(basic const & other) const;
115 unsigned return_type(void) const;
116 unsigned return_type_tinfo(void) const;
117 ex thisexprseq(exvector const & v) const;
118 ex thisexprseq(exvector * vp) const;
120 // new virtual functions which can be overridden by derived classes
123 // non-virtual functions in this class
125 bool all_of_type_lorentzidx(void) const;
136 extern const simp_lor some_simp_lor;
137 extern type_info const & typeid_simp_lor;
141 #define ex_to_simp_lor(X) static_cast<simp_lor const &>(*(X).bp)
142 #define ex_to_nonconst_simp_lor(X) static_cast<simp_lor &>(*(X).bp)
144 simp_lor lor_g(ex const & mu, ex const & nu);
145 simp_lor lor_vec(string const & n, ex const & mu);
146 ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp);
147 ex simplify_simp_lor(ex const & e, scalar_products const & sp);
150 #endif // ndef _SIMP_LOR_H_