We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b48cd3 commit 7941e33Copy full SHA for 7941e33
core/algorithms/zoom.cc
@@ -6,8 +6,8 @@
6
7
using namespace cadabra;
8
9
-zoom::zoom(const Kernel& k, Ex& e, Ex& rules_)
10
- : Algorithm(k, e), rules(rules_)
+zoom::zoom(const Kernel& k, Ex& e, Ex& rules_, bool partial)
+ : Algorithm(k, e), rules(rules_), partial(partial)
11
{
12
// Convert rules into a list (if it isn't already)
13
rules = cadabra::make_list(rules);
@@ -66,7 +66,7 @@ Algorithm::result_t zoom::apply(iterator& it)
66
// Wrap all things which we want to remove from view in an
67
// \ldots node.
68
69
- substitute subs(kernel, tr, rules);
+ substitute subs(kernel, tr, rules, partial);
70
sibling_iterator sib=tr.begin(it);
71
bool hiding=false;
72
sibling_iterator current_ldots=tr.end(it);
core/algorithms/zoom.hh
@@ -7,7 +7,7 @@ namespace cadabra {
class zoom : public Algorithm {
public:
- zoom(const Kernel& k, Ex& e, Ex& r);
+ zoom(const Kernel& k, Ex& e, Ex& r, bool partial = true);
virtual bool can_apply(iterator) override;
virtual result_t apply(iterator&) override;
@@ -17,6 +17,8 @@ namespace cadabra {
17
18
std::vector<sibling_iterator> to_erase;
19
std::vector<Ex::path_t> to_keep;
20
+
21
+ bool partial;
22
};
23
24
}
core/pythoncdb/py_algorithms.cc
@@ -133,7 +133,7 @@ namespace cadabra {
133
def_algo<substitute, Ex, bool>(m, "substitute", true, false, 0, py::arg("rules"), py::arg("partial") = true);
134
def_algo<take_match, Ex>(m, "take_match", true, false, 0, py::arg("rules"));
135
def_algo<replace_match>(m, "replace_match", false, false, 0);
136
- def_algo<zoom, Ex>(m, "zoom", true, false, 0, py::arg("rules"));
+ def_algo<zoom, Ex, bool>(m, "zoom", true, false, 0, py::arg("rules"), py::arg("partial") = true);
137
def_algo_preorder<unzoom>(m, "unzoom", true, false, 0);
138
def_algo<untrace>(m, "untrace", true, false, 0);
139
def_algo<rewrite_indices, Ex, Ex>(m, "rewrite_indices", true, false, 0, py::arg("preferred"), py::arg("converters"));
0 commit comments