*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <algorithm>
#include "mul.h"
#include "matrix.h"
#include "archive.h"
+#include "indexed.h"
#include "utils.h"
namespace GiNaC {
intvector k(number_of_adds);
+ /* Rename indices in the static members of the product */
+ exvector expanded_seq_mod;
+ size_t j = 0;
+ size_t i;
+ for (i=0; i<expanded_seq.size(); i++) {
+ if (i == positions_of_adds[j]) {
+ expanded_seq_mod.push_back(_ex1);
+ j++;
+ } else {
+ expanded_seq_mod.push_back(rename_dummy_indices_uniquely(ncmul(expanded_seq_mod), expanded_seq[i]));
+ }
+ }
+
while (true) {
- exvector term = expanded_seq;
- for (size_t i=0; i<number_of_adds; i++)
- term[positions_of_adds[i]] = expanded_seq[positions_of_adds[i]].op(k[i]);
+ exvector term = expanded_seq_mod;
+ for (i=0; i<number_of_adds; i++) {
+ term[positions_of_adds[i]] = rename_dummy_indices_uniquely(ncmul(term), expanded_seq[positions_of_adds[i]].op(k[i]));
+ }
+
distrseq.push_back((new ncmul(term, true))->
setflag(status_flags::dynallocated | (options == 0 ? status_flags::expanded : 0)));