Cadabra
Computer algebra system for field theory problems
IndexClassifier.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Kernel.hh"
5 #include "Storage.hh"
6 #include "Props.hh"
7 #include "Compare.hh"
8 
10 
11 namespace cadabra {
12 
14 
15  public:
16  IndexClassifier(const Kernel&);
17 
23  typedef std::multimap<Ex, Ex::iterator, tree_exact_less_for_indexmap_obj> index_map_t;
24 
26  typedef std::map<Ex::iterator, int, Ex::iterator_base_less> index_position_map_t;
27 
28 
35  void fill_index_position_map(Ex::iterator, const index_map_t&, index_position_map_t&) const;
36  void fill_map(index_map_t&, Ex::sibling_iterator, Ex::sibling_iterator) const;
37  void print_classify_indices(std::ostream&, Ex::iterator) const;
38 
44 
46  bool move_out=false) const;
47 
48  void classify_add_index(Ex::iterator it, index_map_t& ind_free, index_map_t& ind_dummy) const;
49 
53 
54  void classify_indices_up(Ex::iterator, index_map_t& ind_free, index_map_t& ind_dummy) const;
55 
58 
59  void classify_indices(Ex::iterator, index_map_t& ind_free, index_map_t& ind_dummy) const;
60 
61  int max_numbered_name_one(const std::string& nm, const index_map_t * one) const;
62  int max_numbered_name(const std::string&, const index_map_t *m1, const index_map_t *m2=0,
63  const index_map_t *m3=0, const index_map_t *m4=0, const index_map_t *m5=0) const;
64  Ex get_dummy(const list_property *, const index_map_t *m1, const index_map_t *m2=0,
65  const index_map_t *m3=0, const index_map_t *m4=0, const index_map_t *m5=0) const;
66  Ex get_dummy(const list_property *, Ex::iterator) const;
67  Ex get_dummy(const list_property *, Ex::iterator, Ex::iterator) const;
68 
69  bool index_in_set(Ex, const index_map_t *) const;
70  void dumpmap(std::ostream&, const index_map_t&) const;
71 
73  index_map_t::iterator find_modulo_parent_rel(Ex::iterator it, index_map_t& imap) const;
74 
75  protected:
76  const Kernel& kernel;
77 
78  };
79 
80  }
cadabra::IndexClassifier::max_numbered_name_one
int max_numbered_name_one(const std::string &nm, const index_map_t *one) const
Definition: IndexClassifier.cc:598
cadabra::list_property
Something cannot be both a list property and a normal property at the same time, so we can safely inh...
Definition: Props.hh:192
cadabra::IndexClassifier::index_map_t
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.
Definition: IndexClassifier.hh:23
cadabra::IndexClassifier::fill_index_position_map
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.
Definition: IndexClassifier.cc:24
cadabra::Kernel
Definition: Kernel.hh:15
cadabra::IndexClassifier::IndexClassifier
IndexClassifier(const Kernel &)
Definition: IndexClassifier.cc:15
cadabra::IndexClassifier::index_position_map_t
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.
Definition: IndexClassifier.hh:26
cadabra::IndexClassifier::find_modulo_parent_rel
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.
Definition: IndexClassifier.cc:110
cadabra::IndexClassifier::fill_map
void fill_map(index_map_t &, Ex::sibling_iterator, Ex::sibling_iterator) const
Definition: IndexClassifier.cc:48
cadabra::IndexClassifier::determine_intersection
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 '...
Definition: IndexClassifier.cc:56
cadabra::IndexClassifier::get_dummy
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
Definition: IndexClassifier.cc:486
cadabra::IndexClassifier::dumpmap
void dumpmap(std::ostream &, const index_map_t &) const
Definition: IndexClassifier.cc:263
Storage.hh
Compare.hh
cadabra::IndexClassifier::print_classify_indices
void print_classify_indices(std::ostream &, Ex::iterator) const
Definition: IndexClassifier.cc:570
cadabra::IndexClassifier::classify_add_index
void classify_add_index(Ex::iterator it, index_map_t &ind_free, index_map_t &ind_dummy) const
Definition: IndexClassifier.cc:125
cadabra::IndexClassifier::classify_indices
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...
Definition: IndexClassifier.cc:273
cadabra::one
void one(rset_t::iterator &num)
Definition: Storage.cc:1014
Props.hh
cadabra::IndexClassifier::max_numbered_name
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
Definition: IndexClassifier.cc:619
cadabra::IndexClassifier::classify_indices_up
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.
Definition: IndexClassifier.cc:159
cadabra
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83
cadabra::Ex
Definition: Storage.hh:140
cadabra::IndexClassifier::index_in_set
bool index_in_set(Ex, const index_map_t *) const
Definition: IndexClassifier.cc:646
cadabra::IndexClassifier::kernel
const Kernel & kernel
Definition: IndexClassifier.hh:76
cadabra::IndexClassifier
Definition: IndexClassifier.hh:13
Kernel.hh