- // Canonicalize wrt indices that are dummies within e. I.e., their
- // symbol occurs twice in an index of e. This is only done if there
- // is a cyclic symmetry because in that case it may happen that after
- // raising/lowering an index the indices get reshuffled by ::eval in
- // such a way that the iterators no longer point to the right objects.
- if (ex_to<symmetry>(ex_to<indexed>(e).get_symmetry()).has_cyclic()) {
- // Get dummy pairs of varidxes within the indexed object in e.
- exvector local_var_dummies;
- local_var_dummies.reserve(e.nops()/2);
- for (size_t i=1; i<e.nops(); ++i) {
- if (!is_a<varidx>(e.op(i)))
- continue;
- for (size_t j=i+1; j<e.nops(); ++j) {
- if (is_dummy_pair(e.op(i), e.op(j))) {
- local_var_dummies.push_back(e.op(i));
- for (exvector::iterator k = variant_dummy_indices.begin();
- k!=variant_dummy_indices.end(); ++k) {
- if (e.op(i).op(0) == k->op(0)) {
- variant_dummy_indices.erase(k);
- break;
- }
+ // Find dummy symbols that occur twice in the same indexed object.
+ exvector local_var_dummies;
+ local_var_dummies.reserve(e.nops()/2);
+ for (size_t i=1; i<e.nops(); ++i) {
+ if (!is_a<varidx>(e.op(i)))
+ continue;
+ for (size_t j=i+1; j<e.nops(); ++j) {
+ if (is_dummy_pair(e.op(i), e.op(j))) {
+ local_var_dummies.push_back(e.op(i));
+ for (exvector::iterator k = variant_dummy_indices.begin();
+ k!=variant_dummy_indices.end(); ++k) {
+ if (e.op(i).op(0) == k->op(0)) {
+ variant_dummy_indices.erase(k);
+ break;