From: Chris Dams Date: Thu, 10 Aug 2006 11:35:03 +0000 (+0000) Subject: Fixed bug submitted by Warren Weckesser. X-Git-Tag: release_1-4-0~75 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=36ffb97c48fbbd3acb2b1aa305872e00a4456dc4;p=ginac.git Fixed bug submitted by Warren Weckesser. --- diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index 8e9594b6..bff206f9 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -285,7 +285,7 @@ ex expairseq::op(size_t i) const ex expairseq::map(map_function &f) const { std::auto_ptr v(new epvector); - v->reserve(seq.size()); + v->reserve(seq.size()+1); epvector::const_iterator cit = seq.begin(), last = seq.end(); while (cit != last) { @@ -295,8 +295,15 @@ ex expairseq::map(map_function &f) const if (overall_coeff.is_equal(default_overall_coeff())) return thisexpairseq(v, default_overall_coeff(), true); - else - return thisexpairseq(v, f(overall_coeff), true); + else { + ex newcoeff = f(overall_coeff); + if(is_a(newcoeff)) + return thisexpairseq(v, newcoeff, true); + else { + v->push_back(split_ex_to_pair(newcoeff)); + return thisexpairseq(v, default_overall_coeff(), true); + } + } } /** Perform coefficient-wise automatic term rewriting rules in this class. */