Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
feynmanIntegral.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 FEYNMANINTEGRAL_H_INCLUDED
24 #define FEYNMANINTEGRAL_H_INCLUDED
25 
26 #include <csl.h>
27 #include <complex>
28 namespace mty {
29 
30 enum class IntegralType {
31  None,
32  A,
33  B,
34  C,
35  D,
36  E,
37 };
38 
39 
41 // Utility functions
43 
44 std::ostream& operator<<(std::ostream& out,
45  IntegralType type);
46 
47 void printLooptoolsId(IntegralType type,
48  int id,
49  std::ostream& out);
50 
51 void printLooptoolsId_A(int id,
52  std::ostream& out);
53 
54 void printLooptoolsId_B(int id,
55  std::ostream& out);
56 
57 void printLooptoolsId_C(int id,
58  std::ostream& out);
59 
60 void printLooptoolsId_D(int id,
61  std::ostream& out);
62 
63 void printLooptoolsId_E(int id,
64  std::ostream& out);
65 
66 inline constexpr int loopToolsStep = 3;
67 
68 int loopToolsBegin(IntegralType type,
69  size_t nIndices);
70 
71 int loopToolsIdOf(
72  IntegralType type,
73  std::vector<size_t> const &indices
74  );
75 
76 int loopToolsIdOf_A(
77  std::vector<size_t> const &indices
78  );
79 
80 int loopToolsIdOf_B(
81  std::vector<size_t> const &indices
82  );
83 
84 int loopToolsIdOf_C(
85  std::vector<size_t> const &indices
86  );
87 
88 int loopToolsIdOf_D(
89  std::vector<size_t> const &indices
90  );
91 
92 size_t nPropagatorForIntegral(IntegralType type);
93 
94 size_t nIndicesForIntegral(IntegralType type);
95 
96 size_t nArgumentsForIntegral(IntegralType type);
97 
98 csl::Expr getDivergentFactor(IntegralType type,
99  int integral_id,
100  std::vector<csl::Expr> const& arguments);
101 
102 csl::Expr psquared(csl::Expr const &p);
103 csl::Expr psquared(csl::Expr const &p1, csl::Expr const &p2);
104 csl::Expr psum(csl::Expr const &p1, csl::Expr const &p2);
105 
107 
108  public:
109 
110  inline static bool evaluateIntegrals = false;
111  // inline static const csl::Expr eps = csl::constant_s("reg_int");
112 
113  static csl::Expr replaceIntegral(csl::Expr const& expr);
114 
115  static csl::Expr replaceIntegral(csl::Expr const& argument,
116  csl::Parent const& variable);
117 
118  static csl::Expr applyQSquared(
119  csl::Index const &squaredIndex,
120  csl::Expr const &argument,
121  csl::Parent const &variable,
122  std::vector<csl::Expr> const &factor,
123  std::vector<csl::Expr> const &momentum,
124  std::vector<csl::Expr> const &mass,
125  std::vector<csl::Index> const &indices,
126  csl::Expr const &firstTerm
127  );
128 
129  static void applyIndices(std::vector<csl::Expr>& momentum);
130 
131  static csl::Expr applyIndicesToTensors(
132  csl::Space const* space,
133  std::vector<csl::Expr> const& momentum,
134  std::vector<csl::Index> const& indices,
135  std::vector<size_t> tensorPos);
136 
137  static csl::Expr computeFinalIntegralDecomposition(
138  IntegralType type,
139  std::vector<csl::Expr> const& momentum,
140  std::vector<csl::Index> const& indices,
141  std::vector<csl::Expr> const& arguments);
142 
143  static csl::Expr replaceIntegral(
144  std::vector<csl::Expr> const& factors,
145  std::vector<csl::Expr> const& momentums,
146  std::vector<csl::Expr> const& masses,
147  std::vector<csl::Index> const& indices);
148 
149  static csl::Expr replaceIntegral_A(
150  std::vector<csl::Expr> const& factors,
151  std::vector<csl::Expr> const& momentums,
152  std::vector<csl::Expr> const& masses,
153  std::vector<csl::Index> const& indices);
154 
155  static csl::Expr replaceIntegral_B(
156  std::vector<csl::Expr> const& factors,
157  std::vector<csl::Expr> const& momentums,
158  std::vector<csl::Expr> const& masses,
159  std::vector<csl::Index> const& indices);
160 
161  static csl::Expr replaceIntegral_C(
162  std::vector<csl::Expr> const& factors,
163  std::vector<csl::Expr> const& momentums,
164  std::vector<csl::Expr> const& masses,
165  std::vector<csl::Index> const& indices);
166 
167  static csl::Expr replaceIntegral_D(
168  std::vector<csl::Expr> const& factors,
169  std::vector<csl::Expr> const& momentums,
170  std::vector<csl::Expr> const& masses,
171  std::vector<csl::Index> const& indices);
172 
173  static csl::Expr replaceIntegral_E(
174  std::vector<csl::Expr> const& factors,
175  std::vector<csl::Expr> const& momentums,
176  std::vector<csl::Expr> const& masses,
177  std::vector<csl::Index> const& indices);
178 
179  static void removeExternalMomenta(
180  csl::Expr &expr,
181  csl::Parent const &Q
182  );
183 
184  FeynmanIntegral(IntegralType t_type,
185  int t_looptoolsId,
186  std::vector<csl::Expr> const& t_argument);
187 
188  FeynmanIntegral(IntegralType t_type,
189  int t_looptoolsId,
190  std::vector<csl::Expr> const &t_argument,
191  std::vector<size_t> const &t_indices);
192 
193  ~FeynmanIntegral() override {}
194 
195  int getLoopToolsID() const {
196  return loopToolsId;
197  }
198 
199  IntegralType getIntegralType() const {
200  return type;
201  }
202 
203  std::vector<size_t> const &getIntegralIndices() const {
204  return integralIndices;
205  }
206 
207  bool isIndexed() const override { return false; }
208 
209  void print(int mode = 0,
210  std::ostream& out = std::cout,
211  bool lib = false) const override;
212 
213  std::string printLaTeX(int mode = 0) const override;
214 
215  void printLib(int mode,
216  std::ostream& out) const;
217 
218  csl::LibDependency getLibDependency() const override;
219 
220  std::optional<csl::Expr> evaluate(csl::eval::mode user_mode
221  = csl::eval::base) const override;
222 
223  csl::unique_Expr copy_unique() const override;
224 
225  csl::Expr deepCopy() const override;
226 
227  csl::Expr deepRefresh() const override;
228 
229  bool operator==(csl::Expr_info other) const override;
230 
231  bool operator<(csl::Expr_info other) const override;
232 
233  csl::Expr getDivergentFactor() const;
234 
235  std::vector<csl::Expr> getMomenta() const;
236 
237  std::vector<csl::Expr> getMasses() const;
238 
239  private:
240 
241  std::pair<csl::Expr, csl::Expr> getPair(size_t i) const;
242 
243  bool compare(size_t i, size_t j) const;
244 
245  void sortArgument();
246 
247  static csl::Expr metricTerm(
248  csl::Space const *space,
249  std::vector<csl::Index> const &indices
250  );
251 
252  std::complex<double> evaluateIntegral() const;
253 
254  private:
255 
256  IntegralType type;
257 
258  int loopToolsId;
259 
260  std::vector<size_t> integralIndices;
261 };
262 
263 csl::Expr feynmanintegral_s(IntegralType t_type,
264  int t_looptoolsId,
265  std::vector<csl::Expr> const& t_argument);
266 
267 csl::Expr feynmanintegral_s(IntegralType t_type,
268  int t_looptoolsId,
269  std::vector<csl::Expr> const &t_argument,
270  std::vector<size_t> const &indices);
271 
272 template<class IntegralID>
273 csl::Expr feynmanintegral_s(IntegralType t_type,
274  IntegralID t_looptoolsId,
275  std::vector<csl::Expr> const& t_argument)
276 {
277  return feynmanintegral_s(t_type,
278  static_cast<int>(t_looptoolsId),
279  t_argument);
280 }
281 
282 enum class IntegralID_E {
283  ee0 = 0,
284  ee1 = 3,
285  ee2 = 6,
286  ee3 = 9,
287  ee4 = 12,
288 
289  ee00 = 15,
290  ee11 = 18,
291  ee12 = 21,
292  ee13 = 24,
293  ee14 = 27,
294  ee22 = 30,
295  ee23 = 33,
296  ee24 = 36,
297  ee33 = 39,
298  ee34 = 42,
299  ee44 = 45,
300 
301  ee001 = 48,
302  ee002 = 51,
303  ee003 = 54,
304  ee004 = 57,
305  ee111 = 60,
306  ee112 = 63,
307  ee113 = 66,
308  ee114 = 69,
309  ee122 = 72,
310  ee123 = 75,
311  ee124 = 78,
312  ee133 = 81,
313  ee134 = 84,
314  ee144 = 87,
315  ee222 = 90,
316  ee223 = 93,
317  ee224 = 96,
318  ee233 = 99,
319  ee234 = 102,
320  ee244 = 105,
321  ee333 = 108,
322  ee334 = 111,
323  ee344 = 114,
324  ee444 = 117,
325 
326  ee0000 = 120,
327  ee0011 = 123,
328  ee0012 = 126,
329  ee0013 = 129,
330  ee0014 = 132,
331  ee0022 = 135,
332  ee0023 = 138,
333  ee0024 = 141,
334  ee0033 = 144,
335  ee0034 = 147,
336  ee0044 = 150,
337  ee1111 = 153,
338  ee1112 = 156,
339  ee1113 = 159,
340  ee1114 = 162,
341  ee1122 = 165,
342  ee1123 = 168,
343  ee1124 = 171,
344  ee1133 = 174,
345  ee1134 = 177,
346  ee1144 = 180,
347  ee1222 = 183,
348  ee1223 = 186,
349  ee1224 = 189,
350  ee1233 = 192,
351  ee1234 = 195,
352  ee1244 = 198,
353  ee1333 = 201,
354  ee1334 = 204,
355  ee1344 = 207,
356  ee1444 = 210,
357  ee2222 = 213,
358  ee2223 = 216,
359  ee2224 = 219,
360  ee2233 = 222,
361  ee2234 = 225,
362  ee2244 = 228,
363  ee2333 = 231,
364  ee2334 = 234,
365  ee2344 = 237,
366  ee2444 = 240,
367  ee3333 = 243,
368  ee3334 = 246,
369  ee3344 = 249,
370  ee3444 = 252,
371  ee4444 = 255,
372 
373  ee00001 = 258,
374  ee00002 = 261,
375  ee00003 = 264,
376  ee00004 = 267,
377  ee00111 = 270,
378  ee00112 = 273,
379  ee00113 = 276,
380  ee00114 = 279,
381  ee00122 = 282,
382  ee00123 = 285,
383  ee00124 = 288,
384  ee00133 = 291,
385  ee00134 = 294,
386  ee00144 = 297,
387  ee00222 = 300,
388  ee00223 = 303,
389  ee00224 = 306,
390  ee00233 = 309,
391  ee00234 = 312,
392  ee00244 = 315,
393  ee00333 = 318,
394  ee00334 = 321,
395  ee00344 = 324,
396  ee00444 = 327,
397  ee11111 = 330,
398  ee11112 = 333,
399  ee11113 = 336,
400  ee11114 = 339,
401  ee11122 = 342,
402  ee11123 = 345,
403  ee11124 = 348,
404  ee11133 = 351,
405  ee11134 = 354,
406  ee11144 = 357,
407  ee11222 = 360,
408  ee11223 = 363,
409  ee11224 = 366,
410  ee11233 = 369,
411  ee11234 = 372,
412  ee11244 = 375,
413  ee11333 = 378,
414  ee11334 = 381,
415  ee11344 = 384,
416  ee11444 = 387,
417  ee12222 = 390,
418  ee12223 = 393,
419  ee12224 = 396,
420  ee12233 = 399,
421  ee12234 = 402,
422  ee12244 = 405,
423  ee12333 = 408,
424  ee12334 = 411,
425  ee12344 = 414,
426  ee12444 = 417,
427  ee13333 = 420,
428  ee13334 = 423,
429  ee13344 = 426,
430  ee13444 = 429,
431  ee14444 = 432,
432  ee22222 = 435,
433  ee22223 = 438,
434  ee22224 = 441,
435  ee22233 = 444,
436  ee22234 = 447,
437  ee22244 = 450,
438  ee22333 = 453,
439  ee22334 = 456,
440  ee22344 = 459,
441  ee22444 = 462,
442  ee23333 = 465,
443  ee23334 = 468,
444  ee23344 = 471,
445  ee23444 = 474,
446  ee24444 = 477,
447  ee33333 = 480,
448  ee33334 = 483,
449  ee33344 = 486,
450  ee33444 = 489,
451  ee34444 = 492,
452  ee44444 = 495,
453  eeLAST = 498
454 };
455 
456 enum class IntegralID_D {
457  dd0 = 0,
458  dd1 = 3,
459  dd2 = 6,
460  dd3 = 9,
461 
462  dd00 = 12,
463  dd11 = 15,
464  dd12 = 18,
465  dd13 = 21,
466  dd22 = 24,
467  dd23 = 27,
468  dd33 = 30,
469 
470  dd001 = 33,
471  dd002 = 36,
472  dd003 = 39,
473  dd111 = 42,
474  dd112 = 45,
475  dd113 = 48,
476  dd122 = 51,
477  dd123 = 54,
478  dd133 = 57,
479  dd222 = 60,
480  dd223 = 63,
481  dd233 = 66,
482  dd333 = 69,
483 
484  dd0000 = 72,
485  dd0011 = 75,
486  dd0012 = 78,
487  dd0013 = 81,
488  dd0022 = 84,
489  dd0023 = 87,
490  dd0033 = 90,
491  dd1111 = 93,
492  dd1112 = 96,
493  dd1113 = 99,
494  dd1122 = 102,
495  dd1123 = 105,
496  dd1133 = 108,
497  dd1222 = 111,
498  dd1223 = 114,
499  dd1233 = 117,
500  dd1333 = 120,
501  dd2222 = 123,
502  dd2223 = 126,
503  dd2233 = 129,
504  dd2333 = 132,
505  dd3333 = 135,
506 
507  dd00001 = 138,
508  dd00002 = 141,
509  dd00003 = 144,
510  dd00111 = 147,
511  dd00112 = 150,
512  dd00113 = 153,
513  dd00122 = 156,
514  dd00123 = 159,
515  dd00133 = 162,
516  dd00222 = 165,
517  dd00223 = 168,
518  dd00233 = 171,
519  dd00333 = 174,
520  dd11111 = 177,
521  dd11112 = 180,
522  dd11113 = 183,
523  dd11122 = 186,
524  dd11123 = 189,
525  dd11133 = 192,
526  dd11222 = 195,
527  dd11223 = 198,
528  dd11233 = 201,
529  dd11333 = 204,
530  dd12222 = 207,
531  dd12223 = 210,
532  dd12233 = 213,
533  dd12333 = 216,
534  dd13333 = 219,
535  dd22222 = 222,
536  dd22223 = 225,
537  dd22233 = 228,
538  dd22333 = 231,
539  dd23333 = 234,
540  dd33333 = 237,
541  ddLAST = 240
542 };
543 
544 enum class IntegralID_C {
545  cc0 = 0,
546  cc1 = 3,
547  cc2 = 6,
548 
549  cc00 = 9,
550  cc11 = 12,
551  cc12 = 15,
552  cc22 = 18,
553 
554  cc001 = 21,
555  cc002 = 24,
556  cc111 = 27,
557  cc112 = 30,
558  cc122 = 33,
559  cc222 = 36,
560 
561  cc0000 = 39,
562  cc0011 = 42,
563  cc0012 = 45,
564  cc0022 = 48,
565  cc1111 = 51,
566  cc1112 = 54,
567  cc1122 = 57,
568  cc1222 = 60,
569  cc2222 = 63,
570  ccLAST = 66
571 };
572 
573 enum class IntegralID_B{
574  bb0 = 0,
575  bb1 = 3,
576 
577  bb00 = 6,
578  bb11 = 9,
579 
580  bb001 = 12,
581  bb111 = 15,
582  bbLAST = 18
583 };
584 
585 enum class IntegralID_A {
586  aa0 = 0,
587 
588  aa00 = 3,
589  aaLAST = 6
590 };
591 
592 }
593 
594 #endif
std::ostream & operator<<(std::ostream &fout, csl::Type type)
Namespace of MARTY.
Definition: 2HDM.h:31
Definition: feynmanIntegral.h:106
bool operator==(const Expr &a, const Expr &b)
bool operator<(const Expr &a, const Expr &b)