@@ -72,6 +72,8 @@ bool map_sympy::can_apply(iterator st)
7272
7373Algorithm::result_t map_sympy::apply (iterator& it)
7474 {
75+ // std::cerr << "Apply on " << tr << std::endl;
76+
7577 std::vector<std::string> wrap;
7678 wrap.push_back (head_);
7779
@@ -80,19 +82,17 @@ Algorithm::result_t map_sympy::apply(iterator& it)
8082 for (auto & fac: left)
8183 prod.append_child (prod.begin (), fac);
8284 auto top=prod.begin ();
85+ // std::cerr << "Feeding to sympy " << prod << std::endl;
8386 sympy::apply (kernel, prod, top, wrap, " " , " " );
8487 // Now remove the non-index carrying factors and replace with
8588 // the factors of 'prod' just simplified.
86- sibling_iterator ps=prod.begin (top);
87- while (ps!=prod.end (top)) {
88- tr.insert_subtree (*left.begin (), ps);
89- ++ps;
90- }
91- std::cerr << " Before erasing " << Ex (it) << std::endl;
89+ tr.insert_subtree (*left.begin (), top);
90+ // std::cerr << "Before erasing " << Ex(it) << std::endl;
9291 for (auto & kl: left)
9392 tr.erase (kl);
93+ // std::cerr << "After erasing " << Ex(it) << std::endl;
9494
95- return result_t ::l_no_action ;
95+ return result_t ::l_applied ;
9696 }
9797 else {
9898 sympy::apply (kernel, tr, it, wrap, " " , " " );
0 commit comments