+ GINAC_ASSERT(local_size <= global_size);
+
+ // Construct lists of index symbols
+ exlist local_syms, global_syms;
+ for (unsigned i=0; i<local_size; i++)
+ local_syms.push_back(local_dummy_indices[i].op(0));
+ shaker_sort(local_syms.begin(), local_syms.end(), ex_is_less(), ex_swap());
+ for (unsigned i=0; i<global_size; i++)
+ global_syms.push_back(global_dummy_indices[i].op(0));
+
+ // Remove common indices
+ exlist local_uniq, global_uniq;
+ set_difference(local_syms.begin(), local_syms.end(), global_syms.begin(), global_syms.end(), std::back_insert_iterator<exlist>(local_uniq), ex_is_less());
+ set_difference(global_syms.begin(), global_syms.end(), local_syms.begin(), local_syms.end(), std::back_insert_iterator<exlist>(global_uniq), ex_is_less());
+
+ // Replace remaining non-common local index symbols by global ones
+ if (local_uniq.empty())