|
| | Ex () |
| | Ex (cdb_tree::iterator) |
| | Create a new Ex with a copy of the subtree at the given iterator.
|
| | Ex (const str_node &) |
| | Create new Ex with single head node being a copy of the given node.
|
| | Ex (const Ex &) |
| | Copy constructor: create a full copy of the given other Ex.
|
| | Ex (const std::string &) |
| | Copy constructor: create a full copy of the given other Ex.
|
| | Ex (int) |
| | Create a single-node Ex representing the given integer.
|
| | Ex (double) |
| | Create a single-node Ex representing the given float.
|
| | Ex (int, int) |
| | Create a single-node Ex representing the given rational.
|
| Ex & | operator= (Ex) |
| result_t | state () const |
| void | update_state (result_t) |
| void | reset_state () |
| bool | changed_state () |
| | A status query method mainly to implement a simple method to apply algorithms until they converge.
|
| bool | is_rational () const |
| | Test if the expression is a rational number.
|
| multiplier_t | to_rational () const |
| bool | is_integer () const |
| long | to_integer () const |
| bool | is_string () const |
| bool | equals (const std::string &) const |
| | Comparison operators with primitive types.
|
| bool | is_empty () const |
| | Test if the expression is empty (no content at all).
|
| std::ostream & | print_entire_tree (std::ostream &str) const |
| | Output helpers mainly for debugging purposes.
|
| std::ostream & | print_repr (std::ostream &str, Ex::iterator it) const |
| | Print a representation like Python's 'repr'.
|
| iterator | named_parent (iterator it, const std::string &) const |
| | Step up until matching node is found (if current node matches, do nothing).
|
| iterator | erase_expression (iterator it) |
| hashval_t | calc_hash (iterator it) const |
| | Calculate the hash value for the subtree starting at 'it'.
|
| multiplier_t | arg_to_num (sibling_iterator, unsigned int) const |
| unsigned int | number_of_steps (iterator it) const |
| bool | is_hidden (iterator) const |
| iterator | replace_index (iterator position, const iterator &from, bool keep_parent_rel=false) |
| | Replace the index-like object (originally intended to replace indices only, but now used also for e.g.
|
| iterator | move_index (iterator position, const iterator &from) |
| | As in replace_index, but moves the index rather than making a copy (so that iterators pointing to the original remain valid).
|
| void | list_wrap_single_element (iterator &) |
| | Make sure that the node pointed to is a \comma object, i.e.
|
| void | list_unwrap_single_element (iterator &) |
| iterator | flatten_and_erase (iterator position) |
| | Replace the node with the children of the node, useful for e.g.
|
| bool | operator== (const Ex &other) const |
| | Compare two Ex objects for exact equality; no dummy equivalence or other things that require property information.
|
| void | push_history (const std::vector< Ex::path_t > &) |
| | Push a copy of the current Storstate of the expression onto the history stack.
|
| std::vector< Ex::path_t > | pop_history () |
| | Pop the most recent state of the expression off the history stack; returns the set of paths that we are replacing.
|
| int | history_size () const |
| | Return the size of the history; 0 means no history, just the current expression.
|
|
| static std::ostream & | print_python (std::ostream &str, Ex::iterator it) |
| | Display expression in Python/Cadabra input form.
|
| static std::ostream & | print_recursive_treeform (std::ostream &str, Ex::iterator it) |
| static std::ostream & | print_recursive_treeform (std::ostream &str, Ex::iterator it, unsigned int &number) |
| static sibling_iterator | arg (iterator, unsigned int) |
| | Quick access to arguments or argument lists for A(B)(C,D) type nodes.
|
| static unsigned int | arg_size (sibling_iterator) |
Keeping track of what algorithms have done to this expression.
After a reset_state (or at initialisation), the expression sits in the 'checkpointed' state. When an algorithm acts, it can then move to 'no_action' (unchanged), 'applied' (changed) or 'error'. Once it is in 'error', it will stay there until the next 'reset'. FIXME: the following should implement a stack of states, so that it can be used with nested functions.
| Enumerator |
|---|
| l_checkpointed | |
| l_no_action | |
| l_applied | |
| l_applied_no_new_dummies | |
| l_error | |
| l_cached | |
| bool cadabra::Ex::changed_state |
( |
| ) |
|
A status query method mainly to implement a simple method to apply algorithms until they converge.
Returns true when the expression is in 'checkpointed' or 'applied' state. Will set the state to 'no_action'.
This is used in cadabra::convert_line defined in CdbPython.cc, which essentially defines converge(ex): [block] to mean
ex.reset_state() while ex.changed(): [block]
| Ex::iterator cadabra::Ex::replace_index |
( |
iterator | position, |
|
|
const iterator & | from, |
|
|
bool | keep_parent_rel = false ) |
Replace the index-like object (originally intended to replace indices only, but now used also for e.g.
normal function arguments, as in
\[ \partial_{z}{ A(z) } \]
with a replacement of z).
Note: this originally kept the bracket and parent_rel, but that is not a good idea, because it prevents us from changing those. If we want to use a _{z} pattern replacing a A(z) index, it is better to make a rule that matches (z) and at the time we find and match _{z}. So this should be handled by the replacement_map logic in Compare.cc.