implemented relational::subs()
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 27 May 2002 20:47:10 +0000 (20:47 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 27 May 2002 20:47:10 +0000 (20:47 +0000)
ginac/relational.cpp
ginac/relational.h

index 158c416..bd3b644 100644 (file)
@@ -183,6 +183,17 @@ ex relational::eval(int level) const
        return (new relational(lh.eval(level-1),rh.eval(level-1),o))->setflag(status_flags::dynallocated | status_flags::evaluated);
 }
 
+ex relational::subs(const lst & ls, const lst & lr, bool no_pattern) const
+{
+       const ex & subsed_lh = lh.subs(ls, lr, no_pattern);
+       const ex & subsed_rh = rh.subs(ls, lr, no_pattern);
+
+       if (!are_ex_trivially_equal(lh, subsed_lh) || !are_ex_trivially_equal(rh, subsed_rh))
+               return relational(subsed_lh, subsed_rh, o).basic::subs(ls, lr, no_pattern);
+       else
+               return basic::subs(ls, lr, no_pattern);
+}
+
 ex relational::simplify_ncmul(const exvector & v) const
 {
        return lh.simplify_ncmul(v);
index 089b931..779b1fe 100644 (file)
@@ -57,6 +57,7 @@ public:
        unsigned nops() const;
        ex & let_op(int i);
        ex eval(int level=0) const;
+       ex subs(const lst & ls, const lst & lr, bool no_pattern = false) const;
        ex simplify_ncmul(const exvector & v) const;
 
 protected: