X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Findexed.cpp;h=bc6aa838303f0a9d1df8af635b8fe1cc878e41d0;hp=56fd0b6b4080ebaafa72845978bfea39d5198ae9;hb=834bacb25c9427fb03b8f9b34605738fb59202e1;hpb=504b90fcaeafe013a6f1b32edcc0d6a51561fc35 diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index 56fd0b6b..bc6aa838 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -668,29 +668,6 @@ try_again: } } - // Contraction of symmetric with antisymmetric object is zero - if (num_dummies > 1 - && ex_to(ex_to(*it1).symtree).has_symmetry() - && ex_to(ex_to(*it2).symtree).has_symmetry()) { - - // Check all pairs of dummy indices - for (unsigned idx1=0; idx1subs(subs_lst, repl_lst); - ex swapped2 = it2->subs(subs_lst, repl_lst); - if (it1->is_equal(swapped1) && it2->is_equal(-swapped2) - || it1->is_equal(-swapped1) && it2->is_equal(swapped2)) { - free_indices.clear(); - return _ex0(); - } - } - } - } - // Try to contract the first one with the second one contracted = it1->op(0).bp->contract_with(it1, it2, v); if (!contracted) { @@ -749,6 +726,19 @@ contraction_done: else r = e; + // The result should be symmetric with respect to exchange of dummy + // indices, so if the symmetrization vanishes, the whole expression is + // zero. This detects things like eps.i.j.k * p.j * p.k = 0. + if (local_dummy_indices.size() >= 2) { + lst dummy_syms; + for (int i=0; i