class spmapkey_is_less
{
public:
- bool operator()(const spmapkey & lh, const spmapkey & rh) const
- {
- /*
- cerr << "spmapkey_is_less" << endl;
- cerr << "lh=((" << lh.first.first
- << "," << lh.first.second << "),";
- lh.second.printraw(cerr);
- cerr << ")" << endl;
-
- cerr << "rh=((" << rh.first.first
- << "," << rh.first.second << "),";
- rh.second.printraw(cerr);
- cerr << ")" << endl;
- */
- bool res=lh.first<rh.first ||
- (!(rh.first<lh.first) && lh.second.compare(rh.second)<0 );
- // cout << "result=" << res << endl;
- return res;
- }
+ bool operator()(const spmapkey & lh, const spmapkey & rh) const
+ {
+ /*
+ cerr << "spmapkey_is_less" << endl;
+ cerr << "lh=((" << lh.first.first
+ << "," << lh.first.second << "),";
+ lh.second.printraw(cerr);
+ cerr << ")" << endl;
+
+ cerr << "rh=((" << rh.first.first
+ << "," << rh.first.second << "),";
+ rh.second.printraw(cerr);
+ cerr << ")" << endl;
+ */
+ bool res = lh.first<rh.first
+ || (!(rh.first<lh.first) && lh.second.compare(rh.second)<0);
+ // cout << "result=" << res << endl;
+ return res;
+ }
};
-typedef map<spmapkey,ex,spmapkey_is_less> spmap;
+typedef std::map<spmapkey,ex,spmapkey_is_less> spmap;
class simp_lor;
class scalar_products
{
public:
- void reg(const simp_lor & v1, const simp_lor & v2, const ex & sp);
- bool is_defined(const simp_lor & v1, const simp_lor & v2) const;
- ex evaluate(const simp_lor & v1, const simp_lor & v2) const;
- void debugprint(void) const;
+ void reg(const simp_lor & v1, const simp_lor & v2, const ex & sp);
+ bool is_defined(const simp_lor & v1, const simp_lor & v2) const;
+ ex evaluate(const simp_lor & v1, const simp_lor & v2) const;
+ void debugprint(void) const;
protected:
- static spmapkey make_key(const simp_lor & v1, const simp_lor & v2);
+ static spmapkey make_key(const simp_lor & v1, const simp_lor & v2);
protected:
- spmap spm;
+ spmap spm;
};
/** Base class for simp_lor object */
{
// friends
- friend class scalar_products;
- friend simp_lor lor_g(const ex & mu, const ex & nu);
- friend simp_lor lor_vec(const std::string & n, const ex & mu);
- friend ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
- friend ex simplify_simp_lor(const ex & e, const scalar_products & sp);
-
+ friend class scalar_products;
+ friend simp_lor lor_g(const ex & mu, const ex & nu);
+ friend simp_lor lor_vec(const std::string & n, const ex & mu);
+ friend ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
+ friend ex simplify_simp_lor(const ex & e, const scalar_products & sp);
+
// types
public:
- typedef enum { invalid, // not properly constructed by one of the friend functions
- simp_lor_g,
- simp_lor_vec
- } simp_lor_types;
-
+ typedef enum {
+ invalid, // not properly constructed by one of the friend functions
+ simp_lor_g,
+ simp_lor_vec
+ } simp_lor_types;
+
// member functions
- // default constructor, destructor, copy constructor assignment operator and helpers
+ // default constructor, destructor, copy constructor assignment operator and helpers
public:
- simp_lor();
- ~simp_lor();
- simp_lor(const simp_lor & other);
- const simp_lor & operator=(const simp_lor & other);
+ simp_lor();
+ ~simp_lor();
+ simp_lor(const simp_lor & other);
+ const simp_lor & operator=(const simp_lor & other);
protected:
- void copy(const simp_lor & other);
- void destroy(bool call_parent);
+ void copy(const simp_lor & other);
+ void destroy(bool call_parent);
- // other constructors
+ // other constructors
protected:
- simp_lor(simp_lor_types const t);
- simp_lor(simp_lor_types const t, const ex & i1, const ex & i2);
- simp_lor(simp_lor_types const t, const std::string & n, const ex & i1);
- simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv);
- simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp);
-
- // functions overriding virtual functions from base classes
+ simp_lor(simp_lor_types const t);
+ simp_lor(simp_lor_types const t, const ex & i1, const ex & i2);
+ simp_lor(simp_lor_types const t, const std::string & n, const ex & i1);
+ simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv);
+ simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp);
+
+ // functions overriding virtual functions from base classes
public:
- basic * duplicate() const;
- void printraw(std::ostream & os) const;
- void printtree(std::ostream & os, unsigned indent) const;
- void print(std::ostream & os, unsigned upper_precedence=0) const;
- void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
- bool info(unsigned inf) const;
- ex eval(int level=0) const;
+ basic * duplicate() const;
+ void printraw(std::ostream & os) const;
+ void printtree(std::ostream & os, unsigned indent) const;
+ void print(std::ostream & os, unsigned upper_precedence=0) const;
+ void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
+ bool info(unsigned inf) const;
+ ex eval(int level=0) const;
protected:
- int compare_same_type(const basic & other) const;
- bool is_equal_same_type(const basic & other) const;
- unsigned return_type(void) const;
- unsigned return_type_tinfo(void) const;
- ex thisexprseq(const exvector & v) const;
- ex thisexprseq(exvector * vp) const;
-
- // new virtual functions which can be overridden by derived classes
- // none
-
- // non-virtual functions in this class
+ int compare_same_type(const basic & other) const;
+ bool is_equal_same_type(const basic & other) const;
+ unsigned return_type(void) const;
+ unsigned return_type_tinfo(void) const;
+ ex thisexprseq(const exvector & v) const;
+ ex thisexprseq(exvector * vp) const;
+
+ // new virtual functions which can be overridden by derived classes
+ // none
+
+ // non-virtual functions in this class
protected:
- bool all_of_type_lorentzidx(void) const;
-
+ bool all_of_type_lorentzidx(void) const;
+
// member variables
protected:
- simp_lor_types type;
- std::string name;
+ simp_lor_types type;
+ std::string name;
};
// global constants
extern const simp_lor some_simp_lor;
-extern const type_info & typeid_simp_lor;
+extern const std::type_info & typeid_simp_lor;
// utility functions
inline const simp_lor &ex_to_simp_lor(const ex &e)