From: Jens Vollinga Date: Thu, 19 May 2011 07:44:11 +0000 (+0200) Subject: The patch improves the run time at the expense of using more RAM in some X-Git-Tag: release_1-6-0~12 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=ab1aedf73a5d062bf50ed1e740f38a4503d7fead The patch improves the run time at the expense of using more RAM in some situations. Please note: it doesn't improve the actual algorithm (iteration over all permutations). Thanks to Alexei Sheplyakov. --- diff --git a/ginac/symmetry.cpp b/ginac/symmetry.cpp index 7d1ff978..d93e34cb 100644 --- a/ginac/symmetry.cpp +++ b/ginac/symmetry.cpp @@ -22,6 +22,7 @@ #include "symmetry.h" #include "lst.h" +#include "add.h" #include "numeric.h" // for factorial() #include "operators.h" #include "archive.h" @@ -495,7 +496,8 @@ static ex symm(const ex & e, exvector::const_iterator first, exvector::const_ite // Loop over all permutations (the first permutation, which is the // identity, is unrolled) - ex sum = e; + exvector sum_v; + sum_v.push_back(e); while (std::next_permutation(iv, iv + num)) { lst new_lst; for (unsigned i=0; isetflag(status_flags::dynallocated); delete[] iv; delete[] iv2;