Documentation of CSL
scalar.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 SCALAR_H
24 #define SCALAR_H
25 
26 #include "scalarFunc.h"
27 
28 namespace csl {
29 
30 class Scalar: public AbstractDuoFunc
31 {
32  public:
33 
34  Scalar(Expr const& left,
35  Expr const& right);
36 
37  ~Scalar();
38 
39  csl::Type getType() const override;
40 
41  void print(int mode = 0,
42  std::ostream& out = std::cout,
43  bool lib = false) const override;
44 
45  std::string printLaTeX(int mode = 0) const override;
46 
47  std::optional<Expr> evaluate(
48  csl::eval::mode user_mode = csl::eval::base
49  ) const override;
50 
51  unique_Expr copy_unique() const override;
52 
53  Expr deepCopy() const override;
54 
55  Expr refresh() const override;
56 
57  Expr deepRefresh() const override;
58 
59  bool isIndexed() const override;
60 
61  IndexStructure getIndexStructure() const override;
62 
63  bool compareWithDummy(
64  Expr_info expr,
65  std::map<Index, Index>& constraints,
66  bool keepAllCosntraints = false) const override;
67 
68  bool operator==(Expr_info other) const override;
69 
70  bool operator<(Expr_info other) const override;
71 };
72 
73 Expr scalar_(Expr const& left,
74  Expr const& right);
75 
76 }
77 
78 #endif /* SCALAR_H */
Namespace for csl library.
Definition: abreviation.h:34
Handle functions of multiple arguments. In the case of the call of a simplification function...
Definition: scalarFunc.h:199
bool compareWithDummy(Expr_info expr, std::map< Index, Index > &constraints, bool keepAllCosntraints=false) const override
Comparison disregarding name of dummy indices, i.e. the two expressions * are equals even if dummy in...
Definition: scalar.cpp:119
csl::Type getType() const override
Gives the type of Abstract.
Definition: scalar.cpp:35
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
std::string printLaTeX(int mode=0) const override
Creates a LaTeX output for the Abstract.
Definition: scalar.cpp:58
bool operator==(Expr_info other) const override
Compares the Abstract with another.
Definition: scalar.cpp:151
bool operator<(Expr_info other) const override
Compares the simplicity of the expression to another.
Definition: simplification.cpp:841
bool isIndexed() const override
Definition: scalar.cpp:109
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
IndexStructure getIndexStructure() const override
Definition: scalar.cpp:114
Base classes for scalar functions.
std::optional< Expr > evaluate(csl::eval::mode user_mode=csl::eval::base) const override
Evaluates the Abstract.
Definition: scalar.cpp:72
Manages a std::vector of Index, to be used by an TensorElement.
Definition: index.h:472
void print(int mode=0, std::ostream &out=std::cout, bool lib=false) const override
Displays the abstract in standard output.
Definition: scalar.cpp:40
Definition: scalar.h:30
Expression type/.
Definition: abstract.h:1573