Cadabra
Computer algebra system for field theory problems
|
#include <IndexClassifier.hh>
Public Types | |
typedef std::multimap< Ex, Ex::iterator, tree_exact_less_for_indexmap_obj > | index_map_t |
A map from a pattern to the position where it occurs in the tree. More... | |
typedef std::map< Ex::iterator, int, Ex::iterator_base_less > | index_position_map_t |
A map from the position of each index to the sequential index. More... | |
Public Member Functions | |
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... | |
Protected Attributes | |
const Kernel & | kernel |
typedef std::multimap<Ex, Ex::iterator, tree_exact_less_for_indexmap_obj> cadabra::IndexClassifier::index_map_t |
A map from a pattern to the position where it occurs in the tree.
The comparator is such that we store indices exactly, apart from their multiplicative factor. This means that the index in A_{n} and in A_{-n} are stored in the same way, and one needs to lookup the expression in the tree to find this multiplier. See basic.cdb test 26 for an example that uses this.
typedef std::map<Ex::iterator, int, Ex::iterator_base_less> cadabra::IndexClassifier::index_position_map_t |
A map from the position of each index to the sequential index.
IndexClassifier::IndexClassifier | ( | const Kernel & | k | ) |
void IndexClassifier::classify_add_index | ( | Ex::iterator | it, |
index_map_t & | ind_free, | ||
index_map_t & | ind_dummy | ||
) | const |
void IndexClassifier::classify_indices | ( | Ex::iterator | it, |
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.
void IndexClassifier::classify_indices_up | ( | Ex::iterator | it, |
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.
all free and dummy indices in the product in which this node would end up if a full distribute would be done on the entire expression.
void IndexClassifier::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'.
Store these indices of 'two' in target. If 'move_out' is true, instead move both the indices in 'one' and 'two' (i.e. move instead of copy, and also store the 'one' index). One exception: numerical, coordinate and symbol indices are always kept in 'one'.
void IndexClassifier::dumpmap | ( | std::ostream & | str, |
const index_map_t & | mp | ||
) | const |
void IndexClassifier::fill_index_position_map | ( | Ex::iterator | prodnode, |
const index_map_t & | im, | ||
index_position_map_t & | ipm | ||
) | const |
Routines to find and classify all indices in an expression, taking into account sums and products.
Note that dummy indices do not always come in pairs, for instance in expressions like a_{m n} ( b^{n p} + q^{n p} ) . Similarly, free indices can appear multiple times, as in a_{m} + b_{m} .
void IndexClassifier::fill_map | ( | index_map_t & | mp, |
Ex::sibling_iterator | st, | ||
Ex::sibling_iterator | nd | ||
) | const |
IndexClassifier::index_map_t::iterator IndexClassifier::find_modulo_parent_rel | ( | Ex::iterator | it, |
index_map_t & | imap | ||
) | const |
Find an index in the set, not taking into account index position.
Ex IndexClassifier::get_dummy | ( | const list_property * | dums, |
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 IndexClassifier::get_dummy | ( | const list_property * | dums, |
Ex::iterator | it | ||
) | const |
Ex IndexClassifier::get_dummy | ( | const list_property * | dums, |
Ex::iterator | it1, | ||
Ex::iterator | it2 | ||
) | const |
bool IndexClassifier::index_in_set | ( | Ex | ex, |
const index_map_t * | im | ||
) | const |
int IndexClassifier::max_numbered_name | ( | const std::string & | nm, |
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 |
int IndexClassifier::max_numbered_name_one | ( | const std::string & | nm, |
const index_map_t * | one | ||
) | const |
void IndexClassifier::print_classify_indices | ( | std::ostream & | str, |
Ex::iterator | st | ||
) | const |
|
protected |