ExNode is a combination of an Ex::iterator and an interface which we can use to manipulate the data pointed to by this iterator.
In this way, we can use
for it in ex: ...
loops and still use 'it' to do things like insertion etc. which requires knowing the Ex::iterator.
Iterators are much safer than in C++, because they carry the tree modification interface themselves, and can thus compute their next value for any destructive operation.
Note that ExNode does not really behave like a Python iterator in the strict sense: it does not return copies of nodes in the tree, but rather objects which know how to modify the tree.
|
| | ExNode (const cadabra::Kernel &, std::shared_ptr< cadabra::Ex >) |
| |
| ExNode & | iter () |
| |
| ExNode & | next () |
| |
| ExNode | copy () const |
| |
| std::string | __str__ () const |
| |
| std::string | _latex_ () const |
| |
| std::string | get_name () const |
| |
| void | set_name (std::string) |
| |
| cadabra::Ex | get_ex () const |
| | Create a copy of the Ex pointed to by this iterator. More...
|
| |
| cadabra::str_node::parent_rel_t | get_parent_rel () const |
| |
| void | set_parent_rel (cadabra::str_node::parent_rel_t) |
| |
| pybind11::object | get_multiplier () const |
| |
| void | set_multiplier (pybind11::object) |
| |
| void | replace (std::shared_ptr< cadabra::Ex > rep) |
| | Take a child argument out of the node and add as child of current. More...
|
| |
| ExNode | insert (std::shared_ptr< cadabra::Ex > ins) |
| | Insert a subtree as previous sibling of the current node. More...
|
| |
| ExNode | insert_it (ExNode ins) |
| |
| ExNode | append_child (std::shared_ptr< cadabra::Ex >) |
| | Append a subtree as a child. Return an ExNode pointing to the new child. More...
|
| |
| ExNode | append_child_it (ExNode ins) |
| |
| ExNode | add_ex (std::shared_ptr< cadabra::Ex >) |
| | Add an expression to the given node, adding a sum parent if necessary. More...
|
| |
| void | erase () |
| | Erase the current node, iterator becomes invalid! More...
|
| |
| ExNode | getitem_string (std::string tag) |
| | Get a new iterator which always stays below the current one. More...
|
| |
| ExNode | getitem_iterator (ExNode) |
| |
| void | setitem_string (std::string tag, std::shared_ptr< cadabra::Ex > val) |
| | Set all elements with the indicated tag to the given value. More...
|
| |
| void | setitem_iterator (ExNode, std::shared_ptr< cadabra::Ex > val) |
| |
| ExNode | terms () |
| | Get a new iterator which only iterates over all first-level terms. More...
|
| |
| ExNode | factors () |
| | Get a new iterator which only iterates over all first-level factors. More...
|
| |
| ExNode | own_indices () |
| | Get a new iterator which only iterates over all first-level indices (that is, does not iterate over inherited indices; use 'indices' for that). More...
|
| |
| ExNode | indices () |
| | Get a new iterator which only iterates over all indices (whether direct or inherited). More...
|
| |
| ExNode | free_indices () |
| | Get a new iterator which only iterates over all free indices (whether direct or inherited). More...
|
| |
| ExNode | args () |
| | Get a new iterator which only iterates over all first-level arguments (non-indices). More...
|
| |
| ExNode | children () |
| | Get a new iterator which iterates over all first-level children (a sibling iterator, in other words). More...
|
| |
| void | update (bool first) |
| | Internal function to update the iterator to the next value. More...
|
| |
| | IndexClassifier (const Kernel &) |
| |
| void | fill_index_position_map (Ex::iterator, const index_map_t &, index_position_map_t &) const |
| | Routines to find and classify all indices in an expression, taking into account sums and products. More...
|
| |
| void | fill_map (index_map_t &, Ex::sibling_iterator, Ex::sibling_iterator) const |
| |
| void | print_classify_indices (std::ostream &, Ex::iterator) const |
| |
| void | determine_intersection (index_map_t &one, index_map_t &two, index_map_t &target, bool move_out=false) const |
| | Determine those indices in 'two' which have a name which is identical to an index name occurring in 'one'. More...
|
| |
| void | classify_add_index (Ex::iterator it, index_map_t &ind_free, index_map_t &ind_dummy) const |
| |
| void | classify_indices_up (Ex::iterator, index_map_t &ind_free, index_map_t &ind_dummy) const |
| | Classify indices bottom-up, that is, given a node, it goes up the tree to find. More...
|
| |
| void | classify_indices (Ex::iterator, index_map_t &ind_free, index_map_t &ind_dummy) const |
| | Classify indices top-down, that is, finds the free indices and all dummy index pairs used in the full subtree below a given node. More...
|
| |
| int | max_numbered_name_one (const std::string &nm, const index_map_t *one) const |
| |
| int | max_numbered_name (const std::string &, const index_map_t *m1, const index_map_t *m2=0, const index_map_t *m3=0, const index_map_t *m4=0, const index_map_t *m5=0) const |
| |
| Ex | get_dummy (const list_property *, const index_map_t *m1, const index_map_t *m2=0, const index_map_t *m3=0, const index_map_t *m4=0, const index_map_t *m5=0) const |
| |
| Ex | get_dummy (const list_property *, Ex::iterator) const |
| |
| Ex | get_dummy (const list_property *, Ex::iterator, Ex::iterator) const |
| |
| bool | index_in_set (Ex, const index_map_t *) const |
| |
| void | dumpmap (std::ostream &, const index_map_t &) const |
| |
| index_map_t::iterator | find_modulo_parent_rel (Ex::iterator it, index_map_t &imap) const |
| | Find an index in the set, not taking into account index position. More...
|
| |