23 #ifndef LITERAL_H_INCLUDED 24 #define LITERAL_H_INCLUDED 50 size_t memoryOverhead()
const override;
52 std::vector<Parent> getSubSymbols()
const override;
61 inline AbstractLiteral::AbstractLiteral()
63 props(std::vector<Equation*>(0)){}
87 std::string
const &
getName()
const override;
89 std::string
const &getLatexName()
const override;
113 void setName(
const std::string& name)
override;
119 long double getValue()
const override;
128 void setValue(
long double t_value)
override;
137 void print(
int mode=0,
138 std::ostream& out=std::cout,
139 bool lib =
false)
const override;
143 std::ostream& out=std::cout
146 std::string
printLaTeX(
int mode=0)
const override;
148 std::vector<Parent> getSubSymbols()
const override;
153 csl::eval::mode user_mode = csl::eval::base
165 unique_Expr copy_unique()
const override;
215 std::string
const &
getName()
const override;
217 std::string
const &getLatexName()
const override;
225 void setName(
const std::string& name)
override;
233 bool getElementary()
const override;
235 bool getAllDependencies()
const override;
239 long double getValue()
const override;
250 void setValue(
long double t_value)
override;
254 void setElementary(
bool t_elementary)
override;
256 void setAllDependencies(
bool t_allDependencies)
override;
258 void addDependency(
Expr const& expr)
override;
260 void removeDependency(
Expr const& expr)
override;
267 void print(
int mode=0,
268 std::ostream& out=std::cout,
269 bool lib =
false)
const override;
273 std::ostream& out=std::cout
276 std::string
printLaTeX(
int mode=0)
const override;
278 std::vector<Parent> getSubSymbols()
const override;
283 csl::eval::mode user_mode = csl::eval::base
295 unique_Expr copy_unique()
const override;
348 long double getValue()
const override {
return value;}
364 void setValue(
long double t_value)
override;
366 void print(
int mode=0,
367 std::ostream& out=std::cout,
368 bool lib =
false)
const override;
372 std::ostream& out=std::cout
375 std::string
printLaTeX(
int mode=0)
const override;
383 csl::eval::mode user_mode = csl::eval::base
386 unique_Expr copy_unique()
const override;
388 Expr refresh()
const override;
452 void print(
int mode=0,
453 std::ostream& out=std::cout,
454 bool lib =
false)
const override;
458 std::ostream& out=std::cout
461 std::string
printLaTeX(
int mode=0)
const override;
478 csl::eval::mode user_mode = csl::eval::base
481 unique_Expr copy_unique()
const override;
538 Expr constant_s(std::string
const& name,
541 Expr constant_s(std::string
const& name,
545 Expr constant_s(std::string
const& name,
550 std::string
const& name,
554 std::string
const& name,
559 std::string
const& name,
568 inline csl::allocator<Constant> alloc_constant;
569 inline csl::allocator<Variable> alloc_variable;
577 inline const csl::Expr CSL_I = csl::make_shared<csl::Imaginary>();
583 inline const csl::Expr CSL_PI = csl::constant_s(
592 inline const csl::Expr CSL_E = csl::constant_s(
csl::PrimaryType getPrimaryType() const override
Gives the primary type of Abstract.
Definition: literal.h:46
virtual bool getValued() const
Tells if the expression is valued, i.e. is a function of numbers and valued literals (a Variable or C...
Definition: abstract.cpp:180
void removeProperty(Equation *property) override
Removes a property to the object.
Definition: literal.cpp:60
virtual bool operator<(Expr_info expr) const =0
Compares the simplicity of the expression to another.
const csl::Expr CSL_UNDEF
Constant that is useful in return of non-defined calculations as for example Commutator(): [A...
Definition: literal.h:617
virtual Parent getParent() const
For indicial expressions this function returns a pointer to the parent object of type TensorParent (n...
Definition: abstract.cpp:259
Definition: buildingBlock.h:69
Namespace for csl library.
Definition: abreviation.h:34
int value
Definition: literal.h:322
virtual std::string const & getName() const
Returns the Abstract's name.
Definition: abstract.cpp:37
Expr getImaginaryPart() const override
Evaluates the imaginary part of the Abstract and returns it.
Definition: buildingBlock.cpp:115
virtual long double getValue() const
Returns the value of the expression, if it has one explicitely. In particular, it will work only on N...
Definition: abstract.cpp:572
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
Variable(const std::shared_ptr< VariableParent > &t_parent)
Default constructor.
Definition: literal.h:496
virtual long double evaluateScalar() const
Evaluates the value of the Abstract.
Definition: abstract.cpp:871
csl::PrimaryType getPrimaryType() const override
Definition: literal.h:433
virtual void print(int mode=0, std::ostream &out=std::cout, bool lib=false) const =0
Displays the abstract in standard output.
virtual int getParity(Expr_info t_variable) const
Returns the parity property of the expression with respect to t_variable.
Definition: abstract.cpp:960
std::optional< Expr > getComplexModulus() const override
Evaluates the modulus in the complex plane of the Abstract and returns it.
Definition: buildingBlock.cpp:53
csl::Type getType() const override
Gives the type of the Imaginary.
Definition: literal.h:438
const csl::Expr CSL_INF
Represents infinity in the program.
Definition: literal.h:607
Handle an object with a name and a value.
Definition: literal.h:185
Handles factorial of a Number.
Definition: literal.h:318
virtual std::optional< Expr > getComplexArgument() const
Evaluates the argument in the complex plane of the Abstract and returns it.
Definition: abstract.cpp:677
const std::vector< Equation * > & getProperties() const override
Definition: literal.cpp:47
virtual void operator=(double t_value)
Equivalent to the setValue() function.
Definition: abstract.cpp:972
IntFactorial()
Default Constructor.
Definition: literal.h:508
csl::Type getType() const override
Gives the type of a IntFraction.
Definition: literal.h:359
Definition: diagonalization.h:34
ComplexProperty
Contains all possible complex properties of objects. Real, purely imaginary, or complex.
Definition: enum.h:127
virtual void setValue(long double t_value)
Sets the value if there is one (for Numerical and Literal valued).
Definition: abstract.cpp:794
PrimaryType
Stores enumerations of types for Abstract objects.
Definition: enum.h:31
virtual void setCommutable(bool t_commutable)
Allows the abstract to commute or not.
Definition: abstract.cpp:62
virtual bool commutesWith(Expr_info expr, int sign=-1) const override
Tells if the object commutes with expr.
Definition: buildingBlock.cpp:75
Handle an object with a name and a value.
Definition: literal.h:69
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
std::vector< Equation * > props
Definition: literal.h:40
Imaginary()
Default constructor.
Definition: literal.h:522
Base class for all parents (indicial, fields etc). All parents derive from this class.
Definition: parent.h:81
virtual void setName(const std::string &t_name)
Change the name of the abstract.
Definition: abstract.cpp:57
virtual bool getCommutable() const
Allows to know if the object commutes with all the others.
Definition: abstract.cpp:47
bool operator==(Expr_info other) const override
Compares the Abstract with another.
Definition: buildingBlock.cpp:159
virtual bool dependsOn(Expr_info expr) const
Check recursively if the expression depends on expr.
Definition: abstract.cpp:906
void addProperty(Equation *property) override
Adds a property to the object.
Definition: literal.cpp:52
Abstract class from which derive literal building blocks: Constant, Variable, Imaginary and IntFactor...
Definition: literal.h:35
Expr intfactorial_s(int value)
Definition: literal.cpp:738
virtual std::string printLaTeX(int mode=0) const
Creates a LaTeX output for the Abstract.
Definition: abstract.cpp:168
csl::PrimaryType getPrimaryType() const override
Gives the primary type of a IntFraction.
Definition: literal.h:354
Definition: equation.h:43
virtual csl::Type getType() const =0
Gives the type of Abstract.
Numerical representation of i.
Definition: literal.h:415
Constant(const std::shared_ptr< ConstantParent > &t_parent)
Default constructor.
Definition: literal.h:502
std::optional< Expr > getRealPart() const override
Evaluates the real part of the Abstract and returns it.
Definition: buildingBlock.cpp:106
virtual std::optional< Expr > evaluate(csl::eval::mode user_mode=csl::eval::base) const =0
Evaluates the Abstract.
virtual std::optional< Expr > derive(Expr_info expr) const
Calculates the derivative of the Abstract wrt another.
Definition: abstract.cpp:774
Expression type/.
Definition: abstract.h:1573
long double getValue() const override
Returns the value in the factorial.
Definition: literal.h:348