X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fpower.cpp;h=40ba3376a2af6d17d65cbc73fd992314325fe019;hp=1b28b509ac4bd35ef4bbcf7777e40069bcf056f2;hb=a58e540b7d534d64c1c87cc253b3cf40bf58df06;hpb=da6a61ba2586263e46ade4b67dca121506c2bff9 diff --git a/ginac/power.cpp b/ginac/power.cpp index 1b28b509..40ba3376 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -1010,8 +1010,13 @@ ex power::expand_mul(const mul & m, const numeric & n, unsigned options, bool fr return _ex1; } + // do not bother to rename indices if there are no any. + if ((!(options & expand_options::expand_rename_idx)) + && m.info(info_flags::has_indices)) + options |= expand_options::expand_rename_idx; // Leave it to multiplication since dummy indices have to be renamed - if (get_all_dummy_indices(m).size() > 0 && n.is_positive()) { + if ((options & expand_options::expand_rename_idx) && + (get_all_dummy_indices(m).size() > 0) && n.is_positive()) { ex result = m; exvector va = get_all_dummy_indices(m); sort(va.begin(), va.end(), ex_is_less());