]> www.ginac.de Git - ginac.git/blobdiff - ginac/expairseq.cpp
Finalize 1.7.6 release.
[ginac.git] / ginac / expairseq.cpp
index 5934ca9b9c53e4ea7db602575fad6d7c993602f9..a1361532fc9994c7c920560f3893bca469aea286 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of sequences of expression pairs. */
 
 /*
- *  GiNaC Copyright (C) 1999-2016 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2019 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
@@ -265,7 +265,7 @@ epvector* conjugateepvector(const epvector&epv)
                }
                newepv = new epvector;
                newepv->reserve(epv.size());
-               for (epvector::const_iterator j=epv.begin(); j!=i; ++j) {
+               for (auto j=epv.begin(); j!=i; ++j) {
                        newepv->push_back(*j);
                }
                newepv->push_back(x);
@@ -565,6 +565,11 @@ ex expairseq::recombine_pair_to_ex(const expair &p) const
 
 bool expairseq::expair_needs_further_processing(epp it)
 {
+       if (is_exactly_a<numeric>(it->rest) &&
+           it->coeff.is_equal(_ex1)) {
+               // the pair {<n>, 1} has yet to be absorbed into overall_coeff
+               return true;
+       }
        return false;
 }
 
@@ -888,8 +893,7 @@ void expairseq::make_flat(const epvector &v, bool do_index_renaming)
                    this->can_make_flat(cit)) {
                        ex newrest = mf.handle_factor(cit.rest, cit.coeff);
                        const expairseq &subseqref = ex_to<expairseq>(newrest);
-                       combine_overall_coeff(ex_to<numeric>(subseqref.overall_coeff),
-                                             ex_to<numeric>(cit.coeff));
+                       combine_overall_coeff(subseqref.overall_coeff, cit.coeff);
                        for (auto & cit_s : subseqref.seq) {
                                seq.push_back(expair(cit_s.rest,
                                                     ex_to<numeric>(cit_s.coeff).mul_dyn(ex_to<numeric>(cit.coeff))));