]> www.ginac.de Git - ginac.git/blobdiff - ginac/ex.h
final (?) update for 1.1
[ginac.git] / ginac / ex.h
index dfab1461eb9385b116a7e22d9578fae60297d501..3c8094b1b405b1717f5cc05ce8ae74f0563055a7 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's light-weight expression handles. */
 
 /*
- *  GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -111,11 +111,10 @@ public:
        }
 
        void print(const print_context & c, unsigned level = 0) const;
-       void printtree(std::ostream & os) const;
        void dbgprint(void) const;
        void dbgprinttree(void) const;
        bool info(unsigned inf) const { return bp->info(inf); }
-       unsigned nops() const { return bp->nops(); }
+       size_t nops() const { return bp->nops(); }
        ex expand(unsigned options=0) const;
        bool has(const ex & pattern) const { return bp->has(pattern); }
        ex map(map_function & f) const { return bp->map(f); }
@@ -135,7 +134,8 @@ public:
        ex primpart(const symbol &x) const;
        ex primpart(const symbol &x, const ex &cont) const;
        ex normal(int level = 0) const;
-       ex to_rational(lst &repl_lst) const { return bp->to_rational(repl_lst); }
+       ex to_rational(lst &repl_lst) const;
+       ex to_polynomial(lst &repl_lst) const;
        ex smod(const numeric &xi) const { return bp->smod(xi); }
        numeric max_coefficient(void) const;
        ex collect(const ex & s, bool distributed = false) const { return bp->collect(s, distributed); }
@@ -146,8 +146,8 @@ public:
        ex series(const ex & r, int order, unsigned options = 0) const;
        bool match(const ex & pattern) const;
        bool match(const ex & pattern, lst & repl_lst) const { return bp->match(pattern, repl_lst); }
-       ex subs(const lst & ls, const lst & lr, bool no_pattern = false) const { return bp->subs(ls, lr, no_pattern); }
-       ex subs(const ex & e, bool no_pattern = false) const { return bp->subs(e, no_pattern); }
+       ex subs(const lst & ls, const lst & lr, unsigned options = 0) const { return bp->subs(ls, lr, options); }
+       ex subs(const ex & e, unsigned options = 0) const { return bp->subs(e, options); }
        exvector get_free_indices(void) const { return bp->get_free_indices(); }
        ex simplify_indexed(void) const;
        ex simplify_indexed(const scalar_products & sp) const;
@@ -158,10 +158,12 @@ public:
        ex symmetrize_cyclic(void) const;
        ex symmetrize_cyclic(const lst & l) const;
        ex eval_ncmul(const exvector & v) const { return bp->eval_ncmul(v); }
-       ex operator[](const ex & index) const;
-       ex operator[](int i) const;
-       ex op(int i) const { return bp->op(i); }
-       ex & let_op(int i);
+       ex op(size_t i) const { return bp->op(i); }
+       ex operator[](const ex & index) const { return (*bp)[index]; }
+       ex operator[](size_t i) const { return (*bp)[i]; }
+       ex & let_op(size_t i);
+       ex & operator[](const ex & index);
+       ex & operator[](size_t i);
        ex lhs(void) const;
        ex rhs(void) const;
        int compare(const ex & other) const;
@@ -368,7 +370,7 @@ inline bool are_ex_trivially_equal(const ex &e1, const ex &e2)
 }
 
 // wrapper functions around member functions
-inline unsigned nops(const ex & thisex)
+inline size_t nops(const ex & thisex)
 { return thisex.nops(); }
 
 inline ex expand(const ex & thisex, unsigned options = 0)
@@ -404,6 +406,9 @@ inline ex normal(const ex & thisex, int level=0)
 inline ex to_rational(const ex & thisex, lst & repl_lst)
 { return thisex.to_rational(repl_lst); }
 
+inline ex to_polynomial(const ex & thisex, lst & repl_lst)
+{ return thisex.to_polynomial(repl_lst); }
+
 inline ex collect(const ex & thisex, const ex & s, bool distributed = false)
 { return thisex.collect(s, distributed); }
 
@@ -425,11 +430,11 @@ inline ex series(const ex & thisex, const ex & r, int order, unsigned options =
 inline bool match(const ex & thisex, const ex & pattern, lst & repl_lst)
 { return thisex.match(pattern, repl_lst); }
 
-inline ex subs(const ex & thisex, const ex & e)
-{ return thisex.subs(e); }
+inline ex subs(const ex & thisex, const ex & e, unsigned options = 0)
+{ return thisex.subs(e, options); }
 
-inline ex subs(const ex & thisex, const lst & ls, const lst & lr)
-{ return thisex.subs(ls, lr); }
+inline ex subs(const ex & thisex, const lst & ls, const lst & lr, unsigned options = 0)
+{ return thisex.subs(ls, lr, options); }
 
 inline ex simplify_indexed(const ex & thisex)
 { return thisex.simplify_indexed(); }
@@ -455,7 +460,7 @@ inline ex symmetrize_cyclic(const ex & thisex)
 inline ex symmetrize_cyclic(const ex & thisex, const lst & l)
 { return thisex.symmetrize_cyclic(l); }
 
-inline ex op(const ex & thisex, int i)
+inline ex op(const ex & thisex, size_t i)
 { return thisex.op(i); }
 
 inline ex lhs(const ex & thisex)
@@ -484,6 +489,10 @@ struct ex_is_equal : public std::binary_function<ex, ex, bool> {
        bool operator() (const ex &lh, const ex &rh) const { return lh.is_equal(rh); }
 };
 
+struct op0_is_equal : public std::binary_function<ex, ex, bool> {
+       bool operator() (const ex &lh, const ex &rh) const { return lh.op(0).is_equal(rh.op(0)); }
+};
+
 struct ex_swap : public std::binary_function<ex, ex, void> {
        void operator() (ex &lh, ex &rh) const { lh.swap(rh); }
 };