From e38c977976f6f3403cf08aca37a372e0b1eeb0ea Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 19 May 2003 21:28:44 +0000 Subject: [PATCH] - added lst/exprseq constructor that takes to exvector iterators - dummy index symmetrization slightly more efficient (uses exvector instead of lst) --- ginac/container.pl | 5 +++++ ginac/indexed.cpp | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ginac/container.pl b/ginac/container.pl index 66bef262..bb596449 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -251,6 +251,7 @@ public: public: ${CONTAINER}(${STLT} const & s, bool discardable = false); ${CONTAINER}(${STLT} * vp); // vp will be deleted + ${CONTAINER}(exvector::const_iterator b, exvector::const_iterator e); ${constructors_interface} public: @@ -402,6 +403,10 @@ ${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER}) delete vp; } +${CONTAINER}::${CONTAINER}(exvector::const_iterator b, exvector::const_iterator e) : basic(TINFO_${CONTAINER}), seq(b, e) +{ +} + ${constructors_implementation} ////////// diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index de2e8c96..6914752c 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -826,10 +826,11 @@ contraction_done: // 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 (exvector::size_type i=0; iop(0)); + if (symmetrize(r, dummy_syms).is_zero()) { free_indices.clear(); return _ex0; } @@ -975,17 +976,18 @@ ex simplify_indexed(const ex & e, exvector & free_indices, exvector & dummy_indi if (num_terms_orig < 2 || dummy_indices.size() < 2) return sum; - // Yes, construct list of all dummy index symbols - lst dummy_syms; - for (exvector::size_type i=0; iop(0)); // Chop the sum into terms and symmetrize each one over the dummy // indices std::vector terms; for (size_t i=0; i