Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
cslexpr.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 "multifunction.h"
26 
27 namespace sgl {
28 
29  class CSLExpr: public AbstractLiteral {
30 
31  public:
32 
33  CSLExpr(csl::Expr const &expr)
34  :m_expr(expr)
35  {}
36 
37  bool isZero() const override;
38 
39  csl::Expr const &expr() const override {
40  return m_expr;
41  }
42  csl::Expr &expr() override {
43  return m_expr;
44  }
45 
46  bool contains(csl::Index const &) const override {
47  return false;
48  }
49  void replace(csl::Index const&, csl::Index const&) override {}
50 
51  csl::Expr toCSL(TensorSet const&) const override {
52  return csl::DeepRefreshed(expr());
53  }
54 
55  csl::Expr getFactor() const override;
56  GExpr getTerm() const override;
57 
58  GExpr copy() const override;
59  GExpr refresh() const override;
60 
61  void print(std::ostream &out) const override;
62 
63  private:
64 
65  csl::Expr m_expr;
66  };
67 
68  inline GExpr cslexpr_s(csl::Expr const &expr)
69  {
70  return std::make_shared<CSLExpr>(expr);
71  }
72 }
Definition: tensorset.h:30
Definition: abstractgammasym.h:87
Definition: cslexpr.h:29
Definition: abstractgammasym.h:32
Base class for expressions with arguments in SGL.
Definition: multifunction.h:54