]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.cpp
Fixed bug in expanding expressions containing dummy indices. [V.Kisil]
[ginac.git] / ginac / power.cpp
index bd276c56e454f035eb6043d1c9bf8b30ce769f72..7929768541fd30b9f90fd5693f9776793f9213dc 100644 (file)
@@ -853,8 +853,17 @@ ex power::expand_mul(const mul & m, const numeric & n, unsigned options, bool fr
 {
        GINAC_ASSERT(n.is_integer());
 
-       if (n.is_zero())
+       if (n.is_zero()) {
                return _ex1;
+       }
+
+       // Leave it to multiplication since dummy indices have to be renamed
+       if (get_all_dummy_indices(m).size() > 0) {
+               ex result = m;
+               for (int i=1; i < n.to_int(); i++)
+                       result *= rename_dummy_indices_uniquely(m,m);
+               return result;
+       }
 
        epvector distrseq;
        distrseq.reserve(m.seq.size());