From 4d63df7aa608598e01279d6ec95aea6f023109e1 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Sun, 13 Mar 2016 00:02:57 +0100 Subject: [PATCH] Remove ex::to_rational(lst) and ex::to_polynomial(lst). Those were GiNaC 1.1 compatibility functions. Use the corresponding functions with exmap arguments instead. --- doc/tutorial/ginac.texi | 26 ++++++++++++-------------- ginac/ex.h | 8 -------- ginac/normal.cpp | 36 ------------------------------------ 3 files changed, 12 insertions(+), 58 deletions(-) diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 9af3d527..ecf4a227 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -5502,20 +5502,18 @@ above. You do this by calling @example ex ex::to_polynomial(exmap & m); -ex ex::to_polynomial(lst & l); @end example or @example ex ex::to_rational(exmap & m); -ex ex::to_rational(lst & l); @end example -on the expression to be converted. The supplied @code{exmap} or @code{lst} -will be filled with the generated temporary symbols and their replacement -expressions in a format that can be used directly for the @code{subs()} -method. It can also already contain a list of replacements from an earlier -application of @code{.to_polynomial()} or @code{.to_rational()}, so it's -possible to use it on multiple expressions and get consistent results. +on the expression to be converted. The supplied @code{exmap} will be filled +with the generated temporary symbols and their replacement expressions in a +format that can be used directly for the @code{subs()} method. It can also +already contain a list of replacements from an earlier application of +@code{.to_polynomial()} or @code{.to_rational()}, so it's possible to use +it on multiple expressions and get consistent results. The difference between @code{.to_polynomial()} and @code{.to_rational()} is probably best illustrated with an example: @@ -5526,15 +5524,15 @@ is probably best illustrated with an example: ex a = 2*x/sin(x) - y/(3*sin(x)); cout << a << endl; - lst lp; - ex p = a.to_polynomial(lp); - cout << " = " << p << "\n with " << lp << endl; + exmap mp; + ex p = a.to_polynomial(mp); + cout << " = " << p << "\n with " << mp << endl; // = symbol3*symbol2*y+2*symbol2*x // with @{symbol2==sin(x)^(-1),symbol3==-1/3@} - lst lr; - ex r = a.to_rational(lr); - cout << " = " << r << "\n with " << lr << endl; + exmap mr; + ex r = a.to_rational(mr); + cout << " = " << r << "\n with " << mr << endl; // = -1/3*symbol4^(-1)*y+2*symbol4^(-1)*x // with @{symbol4==sin(x)@} @} diff --git a/ginac/ex.h b/ginac/ex.h index 3b980aab..50777632 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -185,9 +185,7 @@ public: // rational functions ex normal() const; ex to_rational(exmap & repl) const; - ex to_rational(lst & repl_lst) const; ex to_polynomial(exmap & repl) const; - ex to_polynomial(lst & repl_lst) const; ex numer() const; ex denom() const; ex numer_denom() const; @@ -740,18 +738,12 @@ inline ex numer_denom(const ex & thisex) inline ex normal(const ex & thisex) { return thisex.normal(); } -inline ex to_rational(const ex & thisex, lst & repl_lst) -{ return thisex.to_rational(repl_lst); } - inline ex to_rational(const ex & thisex, exmap & repl) { return thisex.to_rational(repl); } inline ex to_polynomial(const ex & thisex, exmap & repl) { return thisex.to_polynomial(repl); } -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); } diff --git a/ginac/normal.cpp b/ginac/normal.cpp index fe749c2b..462a8ad5 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -2398,47 +2398,11 @@ ex ex::to_rational(exmap & repl) const return bp->to_rational(repl); } -// GiNaC 1.1 compatibility function -ex ex::to_rational(lst & repl_lst) const -{ - // Convert lst to exmap - exmap m; - for (auto & it : repl_lst) - m.insert(std::make_pair(it.op(0), it.op(1))); - - ex ret = bp->to_rational(m); - - // Convert exmap back to lst - repl_lst.remove_all(); - for (auto & it : m) - repl_lst.append(it.first == it.second); - - return ret; -} - ex ex::to_polynomial(exmap & repl) const { return bp->to_polynomial(repl); } -// GiNaC 1.1 compatibility function -ex ex::to_polynomial(lst & repl_lst) const -{ - // Convert lst to exmap - exmap m; - for (auto & it : repl_lst) - m.insert(std::make_pair(it.op(0), it.op(1))); - - ex ret = bp->to_polynomial(m); - - // Convert exmap back to lst - repl_lst.remove_all(); - for (auto & it : m) - repl_lst.append(it.first == it.second); - - return ret; -} - /** Default implementation of ex::to_rational(). This replaces the object with * a temporary symbol. */ ex basic::to_rational(exmap & repl) const -- 2.44.0