Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
wick.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 WICK_H_INCLUDED
24 #define WICK_H_INCLUDED
25 
26 #include "quantumField.h"
27 
28 namespace mty {
29 
38 class Wick: public csl::Operator<csl::AbstractFunc> {
39 
40  public:
41 
45  Wick();
46 
51  explicit
52  Wick(const csl::Expr& expr);
53 
57  ~Wick(){};
58 
59  csl::Type getType() const override;
60 
61  void print(int mode=0,
62  std::ostream& out=std::cout,
63  bool lib = false) const override;
64 
65  void printCode(int mode = 0, std::ostream &out = std::cout) const override;
66 
67  std::string printLaTeX(int mode=0) const override;
68 
69  std::optional<csl::Expr> evaluate(
70  csl::eval::mode user_mode = csl::eval::base
71  ) const override;
72 
80  bool operatorAppliesOn(csl::Expr_info expr) const override;
81 
82  csl::Expr getOperand() const override;
83 
84  void setOperand(const csl::Expr& operand) override;
85 
86  bool operator==(csl::Expr_info other) const override;
87 
88  csl::unique_Expr copy_unique() const override;
89 
90  csl::Expr deepCopy() const override;
91 
92  csl::Expr refresh() const override;
93 
94  csl::Expr deepRefresh() const override;
95 
96  private:
97 
107  static int numberOfFields(const csl::Expr& expr);
108 
113  bool checkEvenNumberOfFields() const;
114 
121  void checkRightForm();
122 
123  void expandToRightForm();
124 
125  protected:
126 
131  mutable bool rightForm = false;
132 };
133 
141 csl::Expr wick_s(const csl::Expr& expr);
142 
143 } // End of namespace mty
144 
145 #endif /* WICK_H_INCLUDED */
static int numberOfFields(const csl::Expr &expr)
Counts the number of quantum fields in an expression. Counts also when fields appear to an integer po...
Definition: wick.cpp:38
Namespace of MARTY.
Definition: 2HDM.h:31
bool operatorAppliesOn(csl::Expr_info expr) const override
Wick applies on an expression if and only of it contains quantum fields.
Definition: wick.cpp:189
bool checkEvenNumberOfFields() const
Counts the total number of fields in the (possible) product, and replaces the argument by CSL_0 if th...
Definition: wick.cpp:115
bool rightForm
Boolean that tells if the argument of the operator has the right form to be contracted (see checkRigh...
Definition: wick.h:131
~Wick()
Destructor.
Definition: wick.h:57
csl::Expr wick_s(const csl::Expr &expr)
Tries to create a Wick object with argument expr. Applies operator (see Operator::applyOperator()) to...
Definition: wick.cpp:240
Wick()
Default constructor.
Definition: wick.cpp:26
void checkRightForm()
Checks if the argument contains only quantum fields or powers of quantum fields in a product (Prod)...
Definition: wick.cpp:50
Contains QuantumField and QuantumFieldParent, basic objects handling quantum fields as csl expression...
csl compatible expression representing the operator <> of correlators in quantum field theory...
Definition: wick.h:38