]> www.ginac.de Git - ginac.git/commitdiff
Shortcut conversion ex->numeric->ex in expairseq::make_flat().
authorRichard Kreckel <kreckel@ginac.de>
Wed, 31 Jan 2018 11:18:37 +0000 (12:18 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 31 Jan 2018 11:18:37 +0000 (12:18 +0100)
Of course, passing an ex by reference is always faster than converting
it to a numeric first (even if it is a numeric).

ginac/expairseq.cpp

index 7ce15cb2c581dc84c2b6a7b346a3808a3747a0e1..a67eb4e0d1504e2f525559ccb71e37e296d8348d 100644 (file)
@@ -888,8 +888,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);
                    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))));
                        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))));