Documentation of CSL
commutation.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 COMMUTATION_H_INCLUDED
24 #define COMMUTATION_H_INCLUDED
25 
26 #include "scalarFunc.h"
27 
28 namespace csl {
29 
43 Expr Commutation(const Expr& A, const Expr& B, int sign=-1);
44 
45 Expr Commutation(Expr_info A, Expr_info B, int sign=-1);
46 
61 Expr WeakCommutation(const Expr& A, const Expr& B, int sign=-1);
62 
63 Expr WeakCommutation(Expr_info A, Expr_info B, int sign=-1);
64 
71 
72  protected:
73 
77  int sign;
78 
79  public:
80 
84  Commutator();
85 
94  Commutator(const Expr& A, const Expr& B, int t_sign=-1);
95 
100 
104  csl::Type getType() const override;
105 
109  int getSign() const override;
110 
111  void print(int mode=0,
112  std::ostream& out=std::cout,
113  bool lib = false) const override;
114 
115  std::string printLaTeX(int mode=0) const override;
116 
117  long double evaluateScalar() const override;
118 
119  std::optional<Expr> evaluate(
120  csl::eval::mode user_mode = csl::eval::base
121  ) const override;
122 
123  unique_Expr copy_unique() const override;
124 
125  Expr deepCopy() const override;
126 
127  Expr refresh() const override;
128 
129  Expr deepRefresh() const override;
130 
131  std::optional<Expr> derive(Expr_info expr) const override;
132 
133  int getParity(Expr_info t_variable) const override;
134 
135  bool operator==(Expr_info expr) const override;
136 
137  bool operator<(const Abstract* expr) const override;
138 };
139 
155 Expr commutator_(const Expr& A, const Expr& B, int t_sign=-1);
156 } // End of namespace csl
157 
158 #endif
Expr commutator_(const Expr &A, const Expr &B, int t_sign=-1)
Tries to create a Commutator object of A and B of sign sign.
Definition: commutation.cpp:249
Namespace for csl library.
Definition: abreviation.h:34
int sign
Sign of the commutator. +1 for anti-commutator, -1 for commutator.
Definition: commutation.h:77
Handle functions of multiple arguments. In the case of the call of a simplification function...
Definition: scalarFunc.h:199
~Commutator()
Destructor.
Definition: commutation.h:99
std::optional< Expr > derive(Expr_info expr) const override
Calculates the derivative of the Abstract wrt another.
Definition: commutation.cpp:219
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
Commutator()
Default constructor.
Definition: commutation.cpp:100
csl::Type getType() const override
Gives the type of a Commutator object.
Definition: commutation.cpp:113
Expr WeakCommutation(const Expr &A, const Expr &B, int sign=-1)
Returns the result of the (anit-)commutation of A and B. In most cases it returns CSL_0...
Definition: commutation.cpp:60
long double evaluateScalar() const override
Evaluates the value of the Abstract.
Definition: commutation.cpp:168
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
Base classes for scalar functions.
std::optional< Expr > evaluate(csl::eval::mode user_mode=csl::eval::base) const override
Evaluates the Abstract.
Definition: commutation.cpp:178
int getParity(Expr_info t_variable) const override
Returns the parity property of the expression with respect to t_variable.
Definition: commutation.cpp:225
Object that represents a commutator or an anti-commutator, thus is derived from AbstractDuoFunc that ...
Definition: commutation.h:70
std::string printLaTeX(int mode=0) const override
Creates a LaTeX output for the Abstract.
Definition: commutation.cpp:148
int getSign() const override
Definition: commutation.cpp:118
bool operator==(Expr_info expr) const override
Compares the Abstract with another.
Definition: commutation.cpp:233
Expr Commutation(const Expr &A, const Expr &B, int sign=-1)
Returns the result of the (anit-)commutation of A and B. In most cases it returns CSL_0...
Definition: commutation.cpp:27
void print(int mode=0, std::ostream &out=std::cout, bool lib=false) const override
Displays the abstract in standard output.
Definition: commutation.cpp:123
Expression type/.
Definition: abstract.h:1573