Cadabra
Computer algebra system for field theory problems
Public Types | Public Member Functions | Protected Attributes | List of all members
cadabra::IndexClassifier Class Reference

#include <IndexClassifier.hh>

Inheritance diagram for cadabra::IndexClassifier:
ExNode cadabra::Algorithm cadabra::canonicalise cadabra::collect_components cadabra::collect_factors cadabra::collect_terms cadabra::combine cadabra::complete cadabra::component cadabra::decompose cadabra::decompose_product cadabra::distribute cadabra::drop_keep_weight cadabra::einsteinify cadabra::eliminate_converter cadabra::eliminate_kronecker cadabra::epsilon_to_delta cadabra::evaluate cadabra::expand cadabra::expand_delta cadabra::expand_diracbar cadabra::expand_dummies cadabra::expand_power cadabra::explicit_indices cadabra::factor_in cadabra::factor_out cadabra::fierz cadabra::flatten_product cadabra::flatten_sum cadabra::indexsort cadabra::integrate_by_parts cadabra::join_gamma cadabra::keep_terms cadabra::lower_free_indices cadabra::map_mma cadabra::map_sympy cadabra::meld cadabra::nevaluate cadabra::order cadabra::product_rule cadabra::reduce_delta cadabra::rename_dummies cadabra::replace_match cadabra::rewrite_indices cadabra::simplify cadabra::sort_product cadabra::sort_spinors cadabra::sort_sum cadabra::split cadabra::split_gamma cadabra::split_index cadabra::substitute cadabra::sym cadabra::tab_basics cadabra::tabdimension cadabra::take_match cadabra::untrace cadabra::unwrap cadabra::unzoom cadabra::vary cadabra::young_project cadabra::young_project_product cadabra::young_project_tensor cadabra::zoom

Public Types

typedef std::multimap< Ex, Ex::iterator, tree_exact_less_for_indexmap_objindex_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 Kernelkernel
 

Member Typedef Documentation

◆ 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.

◆ index_position_map_t

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.

Constructor & Destructor Documentation

◆ IndexClassifier()

IndexClassifier::IndexClassifier ( const Kernel k)

Member Function Documentation

◆ classify_add_index()

void IndexClassifier::classify_add_index ( Ex::iterator  it,
index_map_t ind_free,
index_map_t ind_dummy 
) const

◆ classify_indices()

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.

◆ classify_indices_up()

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.

◆ determine_intersection()

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'.

◆ dumpmap()

void IndexClassifier::dumpmap ( std::ostream &  str,
const index_map_t mp 
) const

◆ fill_index_position_map()

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} .

◆ fill_map()

void IndexClassifier::fill_map ( index_map_t mp,
Ex::sibling_iterator  st,
Ex::sibling_iterator  nd 
) const

◆ find_modulo_parent_rel()

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.

◆ get_dummy() [1/3]

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

◆ get_dummy() [2/3]

Ex IndexClassifier::get_dummy ( const list_property dums,
Ex::iterator  it 
) const

◆ get_dummy() [3/3]

Ex IndexClassifier::get_dummy ( const list_property dums,
Ex::iterator  it1,
Ex::iterator  it2 
) const

◆ index_in_set()

bool IndexClassifier::index_in_set ( Ex  ex,
const index_map_t im 
) const

◆ max_numbered_name()

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

◆ max_numbered_name_one()

int IndexClassifier::max_numbered_name_one ( const std::string &  nm,
const index_map_t one 
) const

◆ print_classify_indices()

void IndexClassifier::print_classify_indices ( std::ostream &  str,
Ex::iterator  st 
) const

Member Data Documentation

◆ kernel

const Kernel& cadabra::IndexClassifier::kernel
protected

The documentation for this class was generated from the following files: