Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
kinematics.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 #pragma once
24 
25 #include <csl.h>
26 #include <numeric>
27 #include "insertion.h"
28 
29 namespace mty::wick {
30  class Graph;
31 }
32 
33 namespace mty {
34 
39  class Kinematics {
40 
41  public:
42 
43 
47  Kinematics() = default;
48 
55  explicit
56  Kinematics(std::vector<mty::Insertion> const &t_insertions);
57 
69  Kinematics(
70  std::vector<mty::Insertion> const &t_insertions,
71  std::vector<csl::Tensor> const &t_momenta
72  );
73 
90  Kinematics(
91  std::vector<mty::Insertion> const &t_insertions,
92  std::vector<size_t> const &indices
93  );
94 
99  size_t size() const {
100  return insertions.size();
101  }
102 
110  mty::Insertion const &insertion(size_t i) const {
111  return insertions[i];
112  }
113 
121  csl::Tensor const &momentum(size_t i) const {
122  return momenta[i];
123  }
124 
125  csl::Expr squaredMomentum(size_t i, size_t j) const {
126  return squaredMomenta[squaredMomentumIndex(i, j)];
127  }
128 
132  std::vector<mty::Insertion> const &getInsertions() const {
133  return insertions;
134  }
135 
139  std::vector<csl::Tensor> const &getMomenta() const {
140  return momenta;
141  }
142 
146  std::vector<csl::Tensor> getOrderedMomenta() const;
147 
151  std::vector<csl::Expr> const &getSquaredMomenta() const {
152  return squaredMomenta;
153  }
154 
158  std::vector<size_t> const &getIndices() const {
159  return indices;
160  }
161 
190  csl::Expr getDegreesOfFreedomFactor() const;
191 
202  Kinematics subset(std::vector<size_t> pos) const;
203 
211  void applyPermutation(std::vector<size_t> const &pos);
212 
223  Kinematics applyIndices(
224  std::vector<size_t> const &indices
225  ) const;
226 
227  void sortFromIndices();
228 
229  Kinematics alignedWith(Kinematics const &other) const;
230 
241  static void replace(
242  csl::Expr &expr,
243  Kinematics const &k1,
244  Kinematics const &k2
245  );
246 
247  static Kinematics merge(
248  Kinematics const &k1,
249  Kinematics const &k2
250  );
251 
259  static std::vector<size_t> defaultIndices(size_t N) {
260  std::vector<size_t> indices(N);
261  std::iota(begin(indices), end(indices), 1);
262  return indices;
263  }
264 
273  friend std::ostream &operator<<(
274  std::ostream &out,
275  Kinematics const &kin
276  );
277 
278  private:
279 
288  void initMomentaSquared(std::vector<size_t> const &indices);
289 
303  void addContraction(
304  csl::Tensor &p1,
305  csl::Tensor &p2,
306  csl::Expr const &res
307  );
308 
317  void setSquaredMomentum(
318  size_t i,
319  size_t j,
320  csl::Expr const &res);
321 
331  size_t squaredMomentumIndex(size_t i, size_t j) const {
332  return i * momenta.size() + j;
333  }
334 
335  private:
336 
340  std::vector<mty::Insertion> insertions;
341 
347  std::vector<csl::Tensor> momenta;
348 
357  std::vector<size_t> indices;
358 
379  std::vector<csl::Expr> squaredMomenta;
380  };
381 
382 } // namespace mty
csl::Tensor const & momentum(size_t i) const
Returns the momentum in position i.
Definition: kinematics.h:121
std::vector< mty::Insertion > const & getInsertions() const
Definition: kinematics.h:132
std::vector< csl::Tensor > const & getMomenta() const
Definition: kinematics.h:139
size_t squaredMomentumIndex(size_t i, size_t j) const
Returns the index corresponding to a given momenta product.
Definition: kinematics.h:331
std::ostream & operator<<(std::ostream &fout, csl::Type type)
Namespace of MARTY.
Definition: 2HDM.h:31
mty::Insertion const & insertion(size_t i) const
Returns the insertion in position i.
Definition: kinematics.h:110
std::vector< size_t > const & getIndices() const
Definition: kinematics.h:158
std::vector< csl::Tensor > momenta
Set of external momenta of the process.
Definition: kinematics.h:347
Definition: insertion.h:33
Stores insertion and momenta data and provides a simple interface to manipulate it.
Definition: kinematics.h:39
std::vector< csl::Expr > const & getSquaredMomenta() const
Definition: kinematics.h:151
size_t size() const
Definition: kinematics.h:99
std::vector< size_t > indices
Indices of momenta.
Definition: kinematics.h:357
std::vector< csl::Expr > squaredMomenta
Set of squared external momenta for the process.
Definition: kinematics.h:379
static std::vector< size_t > defaultIndices(size_t N)
Returns the default range of indices form 1 to N.
Definition: kinematics.h:259
std::vector< mty::Insertion > insertions
Set of insertions of the process.
Definition: kinematics.h:340
Definition: feynmanDiagram.h:31