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  }
Basic storage class for symbolic mathemematical expressions.
Definition: Storage.hh:142
Definition: IndexClassifier.hh:13
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
void dumpmap(std::ostream &, const index_map_t &) const
Definition: IndexClassifier.cc:263
int max_numbered_name_one(const std::string &nm, const index_map_t *one) const
Definition: IndexClassifier.cc:598
void classify_add_index(Ex::iterator it, index_map_t &ind_free, index_map_t &ind_dummy) const
Definition: IndexClassifier.cc:125
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
bool index_in_set(Ex, const index_map_t *) const
Definition: IndexClassifier.cc:646
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
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
void print_classify_indices(std::ostream &, Ex::iterator) const
Definition: IndexClassifier.cc:570
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
void fill_map(index_map_t &, Ex::sibling_iterator, Ex::sibling_iterator) const
Definition: IndexClassifier.cc:48
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
IndexClassifier(const Kernel &)
Definition: IndexClassifier.cc:15
const Kernel & kernel
Definition: IndexClassifier.hh:76
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
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
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
Definition: Kernel.hh:15
Something cannot be both a list property and a normal property at the same time, so we can safely inh...
Definition: Props.hh:193
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83
void one(rset_t::iterator &num)
Definition: Storage.cc:1035