Cadabra Computer algebra system for field theory problems
meld.hh
Go to the documentation of this file.
1 #pragma once
2
3 #include <memory>
4 #include <array>
5 #include "Algorithm.hh"
8
10
11  class meld : public Algorithm
12  {
13  public:
14  meld(const Kernel& kernel, Ex& ex, bool project_as_sum = false);
15  virtual ~meld();
16
17  virtual bool can_apply(iterator it) override;
18  virtual result_t apply(iterator& it) override;
19
20  private:
22
23  struct ProjectedTerm {
24  ProjectedTerm(const Kernel& kernel, IndexMap& index_map, Ex& ex, Ex::iterator it);
25  // Return 'true' if the tensor parts are identical up to index structure
26  bool compare(const Kernel& kernel, const ProjectedTerm& other);
27
31  Ex::iterator it;
32  bool changed;
33  };
34
35  struct symmetrizer_t {
37  std::vector<size_t> indices;
39  };
40
41  // Return the tableaux associated with the expression, offsetting
42  // cells with how many indices *deep* it is
43  std::vector<tab_t> collect_tableaux(Ex& ex) const;
44
45  // Collects all the columns and rows of the tableaux starting at node 'it' and combines
46  // similar columns where possible. Returns 'true' if the symmetrizers mean the term is
47  // identically 0
48  bool collect_symmetries(const std::vector<tab_t>& tabs, std::vector<symmetrizer_t>& symmetrizers) const;
49  bool collect_symmetries_as_product(const std::vector<tab_t>& tabs, std::vector<symmetrizer_t>& symmetrizers) const;
50  bool collect_symmetries_as_sum(const std::vector<tab_t>& tabs, std::vector<symmetrizer_t>& symmetrizers) const;
51
52  void symmetrize(ProjectedTerm& adj, const std::vector<symmetrizer_t>& symmetries);
53  void symmetrize_as_product(ProjectedTerm& adj, const std::vector<symmetrizer_t>& symmetrizers);
54  void symmetrize_as_sum(ProjectedTerm& adj, const std::vector<symmetrizer_t>& symmetries);
56
57  // Remove non-diagonal terms of diagonal objects
59  bool apply_diagonals(iterator it);
60
61  // Remove terms which contain contractions of traceless objects
63  bool apply_traceless(iterator it);
64
65  // Apply the symmetry Tr(ABC) = Tr(BCA) = Tr(CAB)
68
69  // Compare Young projections of each term for symmetry
71  bool apply_tableaux(iterator it);
72
73  //bool can_apply_side_relations(iterator it);
74  //bool apply_side_relations(iterator it);
75  //Ex side_relations;
76
79  };
80
81 }
Algorithm.hh
bool collect_symmetries_as_sum(const std::vector< tab_t > &tabs, std::vector< symmetrizer_t > &symmetrizers) const
Definition: meld.cc:840
void symmetrize_as_sum(ProjectedTerm &adj, const std::vector< symmetrizer_t > &symmetries)
Definition: meld.cc:1074
Representation of the index structure of a tensor monomial, using a storage format which resembles an...
bool apply_tableaux(iterator it)
Definition: meld.cc:194
bool can_apply_cycle_traces(iterator it)
Definition: meld.cc:1160
TableauBase.hh
Definition: Kernel.hh:15
virtual bool can_apply(iterator it) override
Definition: meld.cc:41
bool can_apply_tableaux(iterator it)
Definition: meld.cc:177
Definition: sym.hh:9
bool apply_cycle_traces(iterator it)
Definition: meld.cc:1248
IndexMap index_map
Definition: meld.hh:77
bool apply_traceless(iterator it)
Definition: meld.cc:119
void symmetrize_as_product(ProjectedTerm &adj, const std::vector< symmetrizer_t > &symmetrizers)
Definition: meld.cc:965
Ex tensor
Definition: meld.hh:28
void symmetrize_idents(ProjectedTerm &sym)
Definition: meld.cc:1126
yngtab::filled_tableau< unsigned int > tab_t
Definition: TableauBase.hh:11
symmetrizer_t(bool antisymmetric, bool independent)
Definition: meld.hh:36
void symmetrize(ProjectedTerm &adj, const std::vector< symmetrizer_t > &symmetries)
Definition: meld.cc:957
Definition: meld.hh:23
bool changed
Definition: meld.hh:32
Definition: meld.hh:11
ProjectedTerm(const Kernel &kernel, IndexMap &index_map, Ex &ex, Ex::iterator it)
Definition: meld.cc:452
Definition: meld.hh:30
virtual result_t apply(iterator &it) override
Definition: meld.cc:50
yngtab::filled_tableau< unsigned int >
bool collect_symmetries(const std::vector< tab_t > &tabs, std::vector< symmetrizer_t > &symmetrizers) const
Definition: meld.cc:730
Ex::iterator iterator
Definition: Algorithm.hh:70
Definition: meld.hh:29
Definition: Algorithm.hh:59
std::vector< size_t > indices
Definition: meld.hh:37
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Storage.hh:141
bool independent
Definition: meld.hh:38
virtual ~meld()
Definition: meld.cc:36
Ex scalar
Definition: meld.hh:28
Definition: meld.hh:35
bool project_as_sum
Definition: meld.hh:78
bool antisymmetric
Definition: meld.hh:38
bool can_apply_diagonals(iterator it)
Definition: meld.cc:82
bool can_apply_traceless(iterator it)
Definition: meld.cc:113
Representation of a sum of tensor monomials, each having the same tensor names, but with different in...
bool compare(const Kernel &kernel, const ProjectedTerm &other)
Definition: meld.cc:531
const Kernel & kernel
Definition: IndexClassifier.hh:76
result_t
Keeping track of what algorithms have done to this expression.
Definition: Storage.hh:160
std::vector< tab_t > collect_tableaux(Ex &ex) const
Definition: meld.cc:688
meld(const Kernel &kernel, Ex &ex, bool project_as_sum=false)
Definition: meld.cc:28