X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Fsymmetry.cpp;h=a44cfcc5df87d0a8b02d9518d965972883c66620;hb=2c886a86f1d020e927d64ab2c79b20437a6bd561;hp=7d1ff9785298484b97d0fc0dacbaee9b71e8cf7d;hpb=286b0d93528e35957a50c51343e0b4a9bc623bce;p=ginac.git diff --git a/ginac/symmetry.cpp b/ginac/symmetry.cpp index 7d1ff978..a44cfcc5 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" @@ -269,6 +270,18 @@ void symmetry::do_print_tree(const print_tree & c, unsigned level) const // non-virtual functions in this class ////////// +bool symmetry::has_nonsymmetric() const +{ + if (type == antisymmetric || type == cyclic) + return true; + + for (exvector::const_iterator i=children.begin(); i!=children.end(); ++i) + if (ex_to(*i).has_nonsymmetric()) + return true; + + return false; +} + bool symmetry::has_cyclic() const { if (type == cyclic) @@ -495,7 +508,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;