Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
generator.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 MTY_GENERATOR_H_INCLUDED
24 #define MTY_GENERATOR_H_INCLUDED
25 
26 #include <csl.h>
27 #include "representation.h"
28 
29 namespace mty {
30 
31 class GaugedGroup;
32 
34 
35 public:
36 
37  template<class ...Args>
39  mty::GaugedGroup *t_group,
40  mty::Irrep const &t_irrep,
41  Args &&...args)
42  :csl::TensorParent(std::forward<Args>(args)...),
43  group(t_group),
44  irrep(t_irrep)
45  {}
46 
47  void printDefinition(
48  std::ostream &out = std::cout,
49  int indentSize = 4,
50  bool header = false
51  ) const override;
52 
53  csl::Expr operator()(csl::Index index) override;
54 
55  csl::Expr operator()(std::vector<csl::Index> indices) override;
56 
57  csl::Expr operator()(const std::vector<int>& indices) override;
58 
59  std::string getCodeName() const;
60 
61 private:
62 
63  mty::GaugedGroup *group;
64  mty::Irrep irrep;
65 };
66 
67 
69 
70 public:
71 
72  template<class ...Args>
73  GeneratorElement(Args &&...args)
74  :csl::TensorElement(std::forward<Args>(args)...)
75  {}
76 
77  csl::unique_Expr copy_unique() const override;
78 
79  csl::Expr refresh() const override;
80 
81  void printCode(
82  int mode = 0,
83  std::ostream &out = std::cout
84  ) const override;
85 };
86 
87 template<class ...Args>
89  Args &&...args
90  )
91 {
92  return csl::make_shared<GeneratorParent>(
93  std::forward<Args>(args)...
94  );
95 }
96 
97 template<class ...Args>
98 csl::Expr generatorelement_s(
99  Args &&...args
100  )
101 {
102  return csl::make_shared<GeneratorElement>(
103  std::forward<Args>(args)...)
104  ->getCanonicalPermutation();
105 }
106 
107 class Generator: public std::shared_ptr<GeneratorParent> {
108 
109 public:
110 
111  INHERIT_SHARED_PTR_CONSTRUCTOR(Generator, GeneratorParent)
112 
113 
120  mty::GaugedGroup *t_group,
121  mty::Irrep const &t_irrep,
122  const std::string& t_name,
123  const csl::Space* t_space
124  )
125  :Generator(generator_s(t_group, t_irrep, t_name, t_space))
126  {}
127 
135  mty::GaugedGroup *t_group,
136  mty::Irrep const &t_irrep,
137  const std::string& t_name,
138  const std::vector<const csl::Space*>& t_space
139  )
140  :Generator(generator_s(t_group, t_irrep, t_name, t_space))
141  {}
142 
153  mty::GaugedGroup *t_group,
154  mty::Irrep const &t_irrep,
155  const std::string& t_name,
156  const std::vector<const csl::Space*>& t_space,
157  const csl::Expr& t_tensor
158  )
159  :Generator(generator_s(t_group, t_irrep, t_name, t_space, t_tensor))
160  {}
161 
172  mty::GaugedGroup *t_group,
173  mty::Irrep const &t_irrep,
174  const std::string& t_name,
175  const csl::Space* t_space,
176  const csl::Expr& t_tensor
177  )
178  :Generator(generator_s(t_group, t_irrep, t_name, t_space, t_tensor))
179  {}
180 
181 
182  template<class ...Args>
183  inline
184  csl::Expr operator()(Args&& ...args)
185  {
186  return (**this)(std::forward<Args>(args)...);
187  }
188 
189  template<class ...Args>
190  inline
191  csl::Expr operator()(const std::vector<int>& indices, Args&& ...args)
192  {
193  return (**this)(indices, std::forward<Args>(args)...);
194  }
195 
196  template<class ...Args>
197  inline
198  csl::Expr operator()(const std::vector<csl::Index>& indices, Args&& ...args)
199  {
200  return (**this)(indices, std::forward<Args>(args)...);
201  }
202 };
203 
204 DEFINE_SHARED_PTR_OPERATOR(Generator)
205 
206 } // End of namespace mty
207 
208 #endif
Definition: gaugedGroup.h:194
Generator(mty::GaugedGroup *t_group, mty::Irrep const &t_irrep, const std::string &t_name, const std::vector< const csl::Space *> &t_space)
Constructor of a n-indexed parent.
Definition: generator.h:134
Namespace of MARTY.
Definition: 2HDM.h:31
Generator(mty::GaugedGroup *t_group, mty::Irrep const &t_irrep, const std::string &t_name, const csl::Space *t_space, const csl::Expr &t_tensor)
Constructor of a 1-indexed parent, with explicit tensor tensor.
Definition: generator.h:171
Classes handling irreducible representations of semi simple Lie algebras, using the Cartan formalism:...
Definition: generator.h:33
Generator(mty::GaugedGroup *t_group, mty::Irrep const &t_irrep, const std::string &t_name, const std::vector< const csl::Space *> &t_space, const csl::Expr &t_tensor)
Constructor of a n-indexed parent, with explicit tensor tensor.
Definition: generator.h:152
Handles the irreducible representation of a given semi-simple algebra.
Definition: representation.h:42
Definition: generator.h:68
Definition: generator.h:107