From 9bf900398c9e10c1cd486377038c24f9410fcb08 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Fri, 16 Nov 2001 18:59:12 +0000 Subject: [PATCH] * Some minor optimization glitches. --- ginac/add.cpp | 6 +++--- ginac/expairseq.cpp | 2 +- ginac/mul.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ginac/add.cpp b/ginac/add.cpp index 1f71b060..b9eca995 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -445,7 +445,7 @@ expair add::split_ex_to_pair(const ex & e) const { if (is_ex_exactly_of_type(e,mul)) { const mul &mulref(ex_to(e)); - ex numfactor = mulref.overall_coeff; + const ex &numfactor = mulref.overall_coeff; mul *mulcopyp = new mul(mulref); mulcopyp->overall_coeff = _ex1; mulcopyp->clearflag(status_flags::evaluated); @@ -462,7 +462,7 @@ expair add::combine_ex_with_coeff_to_pair(const ex & e, GINAC_ASSERT(is_exactly_a(c)); if (is_ex_exactly_of_type(e, mul)) { const mul &mulref(ex_to(e)); - ex numfactor = mulref.overall_coeff; + const ex &numfactor = mulref.overall_coeff; mul *mulcopyp = new mul(mulref); mulcopyp->overall_coeff = _ex1; mulcopyp->clearflag(status_flags::evaluated); @@ -501,7 +501,7 @@ ex add::recombine_pair_to_ex(const expair & p) const if (ex_to(p.coeff).is_equal(_num1)) return p.rest; else - return p.rest*p.coeff; + return (new mul(p.rest,p.coeff))->setflag(status_flags::dynallocated); } ex add::expand(unsigned options) const diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index fee2665c..08c81d03 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -1466,7 +1466,7 @@ bool expairseq::is_canonical() const * if no members were changed. */ epvector * expairseq::expandchildren(unsigned options) const { - epvector::const_iterator last = seq.end(); + const epvector::const_iterator last = seq.end(); epvector::const_iterator cit = seq.begin(); while (cit!=last) { const ex &expanded_ex = cit->rest.expand(options); diff --git a/ginac/mul.cpp b/ginac/mul.cpp index 065455ea..64b090af 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -745,7 +745,7 @@ ex mul::expand(unsigned options) const * pointer, if sequence is unchanged. */ epvector * mul::expandchildren(unsigned options) const { - epvector::const_iterator last = seq.end(); + const epvector::const_iterator last = seq.end(); epvector::const_iterator cit = seq.begin(); while (cit!=last) { const ex & factor = recombine_pair_to_ex(*cit); -- 2.50.0