X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fexpairseq.h;h=8d083c1613459e7d5ab50e6183b4a83f75ab0822;hp=e4e34653f33ff273774aa91937a5fb1cbdda5a0c;hb=b11c30cf00d90113c924e4a96e8fed0341c246c6;hpb=06eb6b761f4b9d9eed4decd8ed50d94b40b94a0e diff --git a/ginac/expairseq.h b/ginac/expairseq.h index e4e34653..8d083c16 100644 --- a/ginac/expairseq.h +++ b/ginac/expairseq.h @@ -44,7 +44,6 @@ namespace GiNaC { #define EXPAIRSEQ_USE_HASHTAB 0 typedef std::vector epvector; ///< expair-vector -typedef epvector::iterator epviter; ///< expair-vector iterator typedef epvector::iterator epp; ///< expair-vector pointer typedef std::list epplist; ///< list of expair-vector pointers typedef std::vector epplistvector; ///< vector of epplist @@ -88,17 +87,17 @@ public: public: basic * duplicate() const; void print(const print_context & c, unsigned level = 0) const; + unsigned precedence(void) const {return 10;} bool info(unsigned inf) const; unsigned nops() const; ex op(int i) const; ex & let_op(int i); + ex map(map_function & f) const; ex eval(int level=0) const; - ex evalf(int level=0) const; - ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; ex to_rational(lst &repl_lst) const; - ex subs(const lst & ls, const lst & lr) const; + bool match(const ex & pattern, lst & repl_lst) const; + ex subs(const lst & ls, const lst & lr, bool no_pattern = false) const; protected: - ex derivative(const symbol & s) const; int compare_same_type(const basic & other) const; bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; @@ -148,7 +147,7 @@ protected: void remove_hashtab_entry(epvector::const_iterator element); void move_hashtab_entry(epvector::const_iterator oldpos, epvector::iterator newpos); - void sorted_insert(epplist & eppl, epp elem); + void sorted_insert(epplist & eppl, epvector::const_iterator elem); void build_hashtab_and_combine(epvector::iterator & first_numeric, epvector::iterator & last_non_zero, vector & touched, @@ -164,17 +163,13 @@ protected: bool is_canonical() const; epvector * expandchildren(unsigned options) const; epvector * evalchildren(int level) const; - epvector evalfchildren(int level) const; - epvector normalchildren(int level) const; - epvector diffchildren(const symbol & s) const; - epvector * subschildren(const lst & ls, const lst & lr) const; + epvector * subschildren(const lst & ls, const lst & lr, bool no_pattern = false) const; // member variables protected: epvector seq; ex overall_coeff; - static unsigned precedence; #if EXPAIRSEQ_USE_HASHTAB epplistvector hashtab; unsigned hashtabsize; @@ -186,11 +181,20 @@ protected: }; // utility functions + +/** Return the expairseq object handled by an ex. Deprecated: use ex_to(). + * This is unsafe: you need to check the type first. */ inline const expairseq &ex_to_expairseq(const ex &e) { return static_cast(*e.bp); } +/** Specialization of is_exactly_a(obj) for expairseq objects. */ +template<> inline bool is_exactly_a(const basic & obj) +{ + return obj.tinfo()==TINFO_expairseq; +} + } // namespace GiNaC #endif // ndef __GINAC_EXPAIRSEQ_H__