21 #ifndef SCALARFUNC_H_INCLUDED 22 #define SCALARFUNC_H_INCLUDED 68 std::vector<csl::Parent> getSubSymbols()
const override;
72 size_t size()
const override;
75 std::map<Index, Index>& constraints,
76 bool keepAllCosntraints =
false)
const override;
80 Tensor getPoint()
const override;
82 int getNArgs(
int axis=0)
const override;
95 bool isReal()
const override;
97 bool isPurelyImaginary()
const override;
111 const Expr& newExpression)
const override;
123 const Index& indexToReplace,
124 const Index& newIndex,
125 bool refresh =
true)
const override;
127 virtual std::optional<Expr> replaceIndices(
128 std::vector<csl::Index>
const &oldIndices,
129 std::vector<csl::Index>
const &newIndices,
131 bool flipped =
false)
const override;
133 virtual std::optional<Expr>
factor(
bool full=
false)
const override;
135 virtual std::optional<Expr>
factor(
137 bool full=
false)
const override;
139 virtual std::optional<Expr>
collect(
140 std::vector<Expr>
const &factors,
144 std::optional<Expr>
expand(
bool full=
false,
145 bool inPlace=
false)
const override;
156 std::function<
bool(
Expr const&)>
const& f,
158 bool inPlace=
false)
const override;
178 csl::eval::mode user_mode = csl::eval::base)
const override;
186 bool operator<(
const Abstract* expr)
const override;
190 Expr evalNumerical(
Expr const& argument)
const;
232 std::vector<csl::Parent> getSubSymbols()
const override;
238 Tensor getPoint()
const override;
243 int getNArgs(
int axis=0)
const override;
245 size_t size()
const override {
260 const Expr& newExpression)
const override;
268 bool isReal()
const override;
270 bool isPurelyImaginary()
const override;
283 const Index& indexToReplace,
284 const Index& newIndex,
285 bool refresh =
true)
const override;
287 virtual std::optional<Expr> replaceIndices(
288 std::vector<csl::Index>
const &oldIndices,
289 std::vector<csl::Index>
const &newIndices,
291 bool flipped =
false)
const override;
293 virtual std::optional<Expr>
factor(
bool full=
false)
const override;
295 virtual std::optional<Expr>
factor(
297 bool full=
false)
const override;
299 virtual std::optional<Expr>
collect(
300 std::vector<Expr>
const &factors,
304 virtual std::optional<Expr>
expand(
bool full=
false,
305 bool inPlace=
false)
const override;
316 std::function<
bool(
Expr const&)>
const& f,
318 bool inPlace=
false)
const override;
376 std::vector<csl::Parent> getSubSymbols()
const override;
383 int getNArgs(
int axis=0)
const override;
401 const Expr& newExpression)
const override;
403 size_t size()
const override;
405 bool empty()
const override;
410 csl::vector_expr::iterator
begin()
override;
415 csl::vector_expr::iterator
end()
override;
420 csl::vector_expr::const_iterator
begin()
const override;
425 csl::vector_expr::const_iterator
end()
const override;
435 bool isReal()
const override;
437 bool isPurelyImaginary()
const override;
450 const Index& indexToReplace,
451 const Index& newIndex,
452 bool refresh =
true)
const override;
454 virtual std::optional<Expr> replaceIndices(
455 std::vector<csl::Index>
const &oldIndices,
456 std::vector<csl::Index>
const &newIndices,
458 bool flipped =
false)
const override;
460 Tensor getPoint()
const override;
462 virtual std::optional<Expr>
factor(
bool full=
false)
const override;
465 bool full=
false)
const override;
467 virtual std::optional<Expr>
collect(
468 std::vector<Expr>
const &factors,
472 virtual std::optional<Expr>
expand(
bool full=
false,
473 bool inPlace=
false)
const override;
484 std::function<
bool(
Expr const&)>
const& f,
486 bool inPlace=
false)
const override;
virtual std::optional< Expr > factor(bool full=false) const override
Factors the Abstract.
Definition: scalarFunc.cpp:194
Expr const & operator[](int i) const override
Access operator for multi-argument expressions, equivalent to the function getArgument().
Definition: scalarFunc.cpp:349
AbstractFunc()
Default constructor.
Definition: scalarFunc.h:510
csl::PrimaryType getPrimaryType() const override
Gives the primary type of an AbstractDuoFunc.
Definition: scalarFunc.h:220
Namespace for csl library.
Definition: abreviation.h:34
Expr const & getArgument(int iArg=0) const override
Returns the argument of the function.
Definition: scalarFunc.cpp:81
bool dependsOn(Expr_info expr) const override
Check recursively if the expression depends on expr.
Definition: scalarFunc.cpp:301
void setArgument(const Expr &t_argument, int iArg=0) override
Replaced the argument of the AbstractFunc.
Definition: scalarFunc.cpp:151
Handle functions of multiple arguments. In the case of the call of a simplification function...
Definition: scalarFunc.h:199
std::optional< Expr > getComplexConjugate() const override
Calculates and returns the complex conjugate of the expression.
Definition: scalarFunc.cpp:122
Index object that is used for indicial objects.
Definition: index.h:75
std::optional< Expr > findSubExpression(Expr_info subExpression, const Expr &newExpression) const override
Searches a sub-expression and replaces it.
Definition: scalarFunc.cpp:134
bool operator==(Expr_info expr) const override
Compares the Abstract with another.
Definition: scalarFunc.cpp:367
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
Base class for scalar functions of one argument.
Definition: scalarFunc.h:38
csl::vector_expr argument
std::vector containing the arguments.
Definition: scalarFunc.h:349
std::array< Expr, 2 > argument
std::array containing the arguments.
Definition: scalarFunc.h:203
csl::PrimaryType getPrimaryType() const override
Definition: scalarFunc.h:56
Abstract()
Default Constructor.
Definition: abstract.h:92
int getNArgs(int axis=0) const override
Returns the number of arguments of the expression. If the expression is a building block (AbstractBui...
Definition: scalarFunc.cpp:77
bool isIndexed() const override
Definition: scalarFunc.cpp:49
virtual csl::vector_expr::iterator end()
Definition: abstract.cpp:468
std::optional< Expr > getComplexModulus() const override
Evaluates the modulus in the complex plane of the Abstract and returns it.
Definition: scalarFunc.cpp:110
std::optional< Expr > expand(bool full=false, bool inPlace=false) const override
Develops the Abstract.
Definition: scalarFunc.cpp:236
Expr argument
Argument of the considered function.
Definition: scalarFunc.h:42
bool commutesWith(Expr_info expr, int sign=-1) const override
Tells if the object commutes with expr.
Definition: scalarFunc.cpp:318
bool getCommutable() const override
Tells if the AbstractFunc is commutable.
Definition: scalarFunc.cpp:40
PrimaryType
Stores enumerations of types for Abstract objects.
Definition: enum.h:31
virtual csl::PrimaryType getPrimaryType() const override
Gives the primary type of an AbstractMultiFunc.
Definition: scalarFunc.h:364
IndexStructure getIndexStructure() const override
Definition: scalarFunc.cpp:67
Expr getImaginaryPart() const override
Evaluates the imaginary part of the Abstract and returns it.
Definition: scalarFunc.cpp:105
virtual std::optional< Expr > expand_if(std::function< bool(Expr const &)> const &f, bool full=false, bool inPlace=false) const override
Develops the Abstract.
Definition: scalarFunc.cpp:250
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
virtual void setVectorArgument(const csl::vector_expr &t_argument)
Replaced the entire std::vector of argument.
Definition: abstract.cpp:859
virtual std::optional< Expr > replaceIndex(const Index &indexToReplace, const Index &newIndex, bool refresh=true) const override
For indicial expressions, this function searches indexToContract and replaces it with newIndex...
Definition: scalarFunc.cpp:155
csl::Type getType() const override
Gives the type of Abstract.
Definition: scalarFunc.h:214
AbstractMultiFunc()
Default Constructor, initializes the std::vector argument empty.
Definition: scalarFunc.h:528
virtual std::optional< Expr > collect(std::vector< Expr > const &factors, bool full=false) const override
Collects terms in sum according to some factors given by the user.
Definition: scalarFunc.cpp:220
Base class for all parents (indicial, fields etc). All parents derive from this class.
Definition: parent.h:81
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: scalarFunc.cpp:53
bool dependsExplicitlyOn(Expr_info expr) const override
Check recursively if expr is present in the expression.
Definition: scalarFunc.cpp:309
Handle functions of multiple arguments. In the case of the call of a simplification function...
Definition: scalarFunc.h:345
csl::Type getType() const override
Gives the type of Abstract.
Definition: scalarFunc.h:357
std::optional< Expr > getComplexArgument() const override
Evaluates the argument in the complex plane of the Abstract and returns it.
Definition: scalarFunc.cpp:116
virtual csl::vector_expr::iterator begin()
Definition: abstract.cpp:461
bool operator<(const Expr &a, const Expr &b)
see Abstract::operator<()
Definition: abstract.cpp:1423
Definition: indicial.h:675
std::optional< Expr > getRealPart() const override
Evaluates the real part of the Abstract and returns it.
Definition: scalarFunc.cpp:100
Manages a std::vector of Index, to be used by an TensorElement.
Definition: index.h:472
int isPolynomial(Expr_info expr) const override
Determines if the expression is a mononomial term in expr, i.e. a term of the form C*expr^n with C in...
Definition: scalarFunc.cpp:323
AbstractDuoFunc()
Default Constructor, initializes the std::array argument empty.
Definition: scalarFunc.h:515
Expression type/.
Definition: abstract.h:1573
std::optional< Expr > evaluate(csl::eval::mode user_mode=csl::eval::base) const override
Evaluates the function after evaluating the argument.
Definition: scalarFunc.cpp:327
virtual const csl::vector_expr & getVectorArgument() const
Allows to get the entire std::vector of arguments of the expression.
Definition: abstract.cpp:441