Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
colorSpace.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef COLORSPACE_H_INCLUDED
24 #define COLORSPACE_H_INCLUDED
25 
26 #include <csl.h>
27 #include <functional>
28 #include "semiSimpleAlgebra.h"
29 #include "group.h"
30 
31 namespace mty {
32  class TraceIdentity;
33 }
34 namespace color {
35 
36 struct TraceIndices {
37  csl::Expr factor = CSL_1;
38  std::vector<csl::Index> indices;
39  size_t symmetry = 1;
40 
41  IMPLEMENTS_STD_VECTOR(csl::Index, indices)
42 
43  bool isSymmetrized() const {
44  return indices.size() <= 2
45  or symmetry == indices.size() - 1;
46  }
47 
48  friend std::ostream &operator<<(
49  std::ostream &out,
50  TraceIndices const &trace);
51 };
52 
57 class ColorSpace: public csl::Space {
58 
59  public:
60 
61  ColorSpace(const mty::SemiSimpleGroup* t_group,
62  const std::string& t_name,
63  int t_dim,
64  bool adjoint);
65 
66  void printCode(
67  std::ostream &out,
68  int indentSize
69  ) const override;
70 
71  void printDefinition(
72  std::ostream &out,
73  int indentSize,
74  bool header = false
75  ) const override;
76 
77  std::string getName() const override;
78 
79  bool hasSpecialTraceProperty(
80  const csl::vector_expr& tensors) const override;
81 
82  csl::Expr calculateTrace(csl::vector_expr tensors) const override;
83 
84  mty::SemiSimpleGroup const *getGroup() const {
85  return group;
86  }
87 
88  bool isInstance(csl::Expr const &tensor) const;
89 
90  void applyE(
91  size_t j,
92  std::vector<TraceIndices> &terms
93  ) const;
94 
95  std::vector<TraceIndices> symmetrize(TraceIndices const &init) const;
96 
97  csl::Expr applySingleTraceIdentity(
98  TraceIndices const &trace,
99  mty::TraceIdentity const &id
100  ) const;
101 
102  csl::Expr applyTraceIdentity(
103  TraceIndices const &trace,
104  std::vector<mty::TraceIdentity> const &identities
105  ) const;
106 
107  csl::Expr symmetrizedTrace(TraceIndices const &trace) const;
108 
109  void mergeTraces(std::vector<TraceIndices> &traces) const;
110 
111  bool contractCloseIndices(
112  TraceIndices &indices,
113  csl::Expr const &CR,
114  csl::Expr const &CA) const;
115 
116  std::vector<TraceIndices> commuteTo(
117  TraceIndices const &indices,
118  size_t init,
119  size_t targetPos
120  ) const;
121 
122  std::vector<TraceIndices> contractFarIndices(
123  TraceIndices const &indices,
124  csl::Expr const &CR,
125  csl::Expr const &CA) const;
126 
127  std::vector<TraceIndices> contractStructureConstants(
128  TraceIndices const &indices,
129  csl::Expr const &CR,
130  csl::Expr const &CA) const;
131 
132  using Modifier = std::function<
133  std::vector<TraceIndices>(
134  TraceIndices const &init
135  )>;
136 
137  bool applyModifier(
138  std::vector<TraceIndices> &indices,
139  Modifier const &f
140  ) const;
141 
142  bool contractFarIndices(
143  std::vector<TraceIndices> &indices,
144  csl::Expr const &CR,
145  csl::Expr const &CA) const;
146 
147  bool contractStructureConstants(
148  std::vector<TraceIndices> &indices,
149  csl::Expr const &CR,
150  csl::Expr const &CA) const;
151 
152  std::vector<TraceIndices>
153  contractIndices(
154  std::vector<csl::Index> const &indices,
155  mty::Irrep const &irrep
156  ) const;
157 
158  csl::Tensor getF() const;
159 
160  csl::Tensor getD(size_t p) const;
161 
162  csl::Tensor getDTilde() const;
163 
164  private:
165 
166  std::vector<csl::Index> exprToIndices(
167  std::vector<csl::Expr> const &tensors
168  ) const;
169 
170  std::tuple<csl::Index, csl::Index, int> getFreeIndices(
171  const csl::Expr& tensorA,
172  const csl::Expr& tensorB
173  ) const;
174 
175  std::tuple<csl::Index, csl::Index, int> getFreeIndicesAdjoint(
176  const csl::Expr& tensorA,
177  const csl::Expr& tensorB
178  ) const;
179 
180  private:
181 
182  const mty::SemiSimpleGroup* group;
183 
184  const mty::SemiSimpleAlgebra* algebra;
185 };
186 
187 }
188 
189 #endif
Base class for all Semi simple groups, i.e. groups that has a SemiSimpleAlgebra.
Definition: group.h:219
Group objects handling different possible symmetry groups. For now only semi-simple groups have repre...
std::ostream & operator<<(std::ostream &fout, csl::Type type)
Namespace of MARTY.
Definition: 2HDM.h:31
Definition: traceIdentities.h:31
Abstract base class for all semi-simple Lie algebras.
Definition: semiSimpleAlgebra.h:96
Class inherited from csl::Space that is used for vector spaces of group representations, in particular for generators.
Definition: colorSpace.h:57
Definition: colorSpace.h:36
Handles the irreducible representation of a given semi-simple algebra.
Definition: representation.h:42
Semi simple Lie algebras: calculations of highest weight representations, products and sums of repres...
Definition: amplitudeSimplification.h:38