Documentation of CSL
Data Structures | Typedefs | Enumerations | Functions | Variables
csl Namespace Reference

Namespace for csl library. More...

Data Structures

class  Abbrev
 
class  Abbreviation
 
class  Abs
 Final specialization of AbstractFunc, the abs function. More...
 
class  Abstract
 Root class of the inheritance tree of abstracts. More...
 
class  AbstractBuildingBlock
 Abstract class from which derive all building blocks of exprs, i.e. objects not function of further exprs: the leafs of the recursive tree. More...
 
class  AbstractDuoFunc
 Handle functions of multiple arguments. In the case of the call of a simplification function, if recursive, the function will be first applied on all the arguments, then to the function itself. More...
 
class  AbstractElement
 Base class for all elements. Objects that are constructed by a parent (see AbstractParent) when the user give it what is needed to create the element (indices, space-time point etc). More...
 
class  AbstractField
 
class  AbstractFunc
 Base class for scalar functions of one argument. More...
 
class  AbstractIntegral
 
class  AbstractLiteral
 Abstract class from which derive literal building blocks: Constant, Variable, Imaginary and IntFactorial. More...
 
class  AbstractMultiFunc
 Handle functions of multiple arguments. In the case of the call of a simplification function, if recursive, the function will be first applied on all the arguments, then to the function itself. More...
 
class  AbstractNumerical
 Abstract class from which derive numerical types, i.e. Float, Integer, IntFraction. More...
 
class  AbstractParent
 Base class for all parents (indicial, fields etc). All parents derive from this class. More...
 
class  AbstractVectorial
 
class  ACos
 Final specialization of AbstractFunc, the acos function. More...
 
class  ACosh
 Final specialization of AbstractFunc, the acosh function. More...
 
class  Angle
 Handles a angle of 2 arguments. More...
 
class  Arbitrary
 Arbitrary object that can enter mathematical expressions. More...
 
class  ASin
 Final specialization of AbstractFunc, the asin function. More...
 
class  ASinh
 Final specialization of AbstractFunc, the asinh function. More...
 
class  ATan
 Final specialization of AbstractFunc, the atan function. More...
 
class  ATanh
 Final specialization of AbstractFunc, the atanh function. More...
 
struct  canDecay
 
class  Commutator
 Object that represents a commutator or an anti-commutator, thus is derived from AbstractDuoFunc that handles two arguments -> [A,B]. More...
 
class  Comparator
 Bunch of functions that allow to do comparisons with Arbitrary expressions or expressions with dummy objects (summed indices or variables). This is a static class, in the sense that all methods and attributes are static i.e. independant of any isntance of the class. There is then no Comparator object constructed, the class just allows to centralize all variables and functions useful for those comparisons. More...
 
class  Complex
 
class  Complexified
 
class  Constant
 Handle an object with a name and a value. More...
 
class  ConstantParent
 
class  ContractionChain
 
class  Cos
 Final specialization of AbstractFunc, the cos function. More...
 
class  Cosh
 Final specialization of AbstractFunc, the cosh function. More...
 
class  DeltaParent
 Specialization of TensorParent for a kronecker delta. More...
 
class  Derivative
 Handles the exponentiation of one Abstract wrt another. More...
 
class  Diagonalizer
 
class  DiracDelta
 
class  EpsilonParent
 Specialization of TensorParent for a kronecker delta. More...
 
class  Equation
 
class  Exp
 Final specialization of AbstractFunc, the exponential function. More...
 
struct  ExpansionChain
 
class  Expr
 Expression type/. More...
 
class  Factorial
 Final specialization of AbstractFunc, the factorial function. More...
 
class  FieldParent
 
class  Float
 Handle numbers in expr. More...
 
class  float_sap
 
class  float_sap< 0 >
 
class  float_sap< 1 >
 
class  format
 
class  Formatter
 
class  Functional
 
class  HighDTensor
 
class  Imaginary
 Numerical representation of i. More...
 
class  ImaginaryPart
 
class  Index
 Index object that is used for indicial objects. More...
 
class  IndexedSymmetry
 
class  IndexStructure
 Manages a std::vector of Index, to be used by an TensorElement. More...
 
class  IndexStructure_new
 
class  IndexStructureView
 
class  IndicialEquation
 
class  InitSanitizer
 Encapsulates a value of a given to ensure that it initialized when used. More...
 
class  int_ap
 
class  int_ap< 0 >
 
class  int_ap< 1 >
 
class  Integer
 Handle numbers in expr. More...
 
class  Integral
 
class  IntFactorial
 Handles factorial of a Number. More...
 
class  IntFraction
 Handles fractions of Number. More...
 
class  IProd
 Specialization of a Prod object to handle TensorElement objects in the product (apply contraction of indices etc). More...
 
class  ISum
 Specialization of a Prod object to handle TensorElement objects in the product (apply contraction of indices etc). More...
 
class  LibDependency
 
class  LibEval
 
class  LibEvalSession
 
class  LibFunction
 
struct  LibParameter
 
class  LibraryExpander
 
class  LibraryGenerator
 
class  LibraryGroup
 
class  linear_map
 
class  LiteralParent
 
class  Lock
 Static class allowing to compress expressions given a boolean predicate. More...
 
class  Log
 Final specialization of AbstractFunc, the logarithm function. More...
 
class  Matrix
 
class  MetricParent
 Specialization of TensorParent for a matric object (two indices symmetric etc). An object of type Space initializated with a metric will automatically have signed indices. More...
 
class  MultiPermutation
 
class  NumericalEval
 
class  ObjectPermutation
 
class  ObjectSymmetry
 
class  Operator
 Linear operator O(a*X+b*Y) = a*O(X) + b*O(Y) More...
 
class  OptionalCondition
 
class  Parent
 
class  Permutation
 Handles a std::vector of integers that represents the permutation of n indices, with a possible symmetry of an IndexStructure. More...
 
class  Polynomial
 Handles a polynomial, function of multiple arguments. More...
 
class  Pow
 Handles the exponentiation of one Abstract wrt another. More...
 
class  Prod
 Handles a product, function of multiple arguments. More...
 
class  ProgressBar
 
class  PropertyList
 
class  PseudoIntegral
 
class  RealPart
 
class  Scalar
 
class  ScalarField
 
class  ScalarFieldParent
 
class  ScalarIntegral
 
class  ScopedProperty
 
class  SelfContraction
 Small class that allows to handle contractions of indices between tensors. More...
 
class  Sin
 Final specialization of AbstractFunc, the sin function. More...
 
class  Sinh
 Final specialization of AbstractFunc, the sinh function. More...
 
class  Space
 Vector space that has a name, a dimension, a delta tensor and possibly a non-trivial metric. If a metric is given, the indices in this space are signed, i.e. their up- or down- position matter in expressions. More...
 
struct  Structure
 
class  Sum
 Handles a sum, function of multiple arguments. More...
 
class  Symmetry
 Handles the full symmetry properties of an TensorElement, i.e. a vector of Permutation objects, each giving a permutation of the indices and the sign of the permutation (if the permutation is symmetric or anti-symmetric). More...
 
class  Tan
 Final specialization of AbstractFunc, the tan function. More...
 
class  Tanh
 Final specialization of AbstractFunc, the tanh function. More...
 
class  TDerivative
 
class  TDerivativeElement
 
class  TDerivativeParent
 
class  Tensor
 
class  TensorElement
 Specialization of Abstract for Indicial tensor. Building block carrying indices, and respecting Einstein's summation convention. More...
 
class  TensorField
 
class  TensorFieldElement
 
class  TensorFieldParent
 
class  TensorParent
 Parent of an indicial object, allows to generate them (TensorElement). More...
 
class  TimeMonitor
 
class  Timer
 
class  Variable
 Handle an object with a name and a value. More...
 
class  VariableParent
 
class  Vector
 
class  VectorIntegral
 

Typedefs

template<class T >
using allocator = std::allocator< T >
 
using ExpanderEmitter = std::function< bool(csl::Expr const &)>
 
using ExpanderReceiver = std::function< bool(csl::Expr const &, csl::Expr const &)>
 
using replacementRule = std::function< std::optional< csl::Expr >(csl::Expr const &, bool)>
 Replacement rule prototype. More...
 
typedef const csl::AbstractExpr_info
 
typedef std::shared_ptr< const csl::AbstractExpr_c
 
typedef std::unique_ptr< csl::Abstractunique_Expr
 
typedef std::unique_ptr< const csl::Abstractunique_Expr_c
 
typedef std::weak_ptr< csl::Abstractweak_Expr
 
typedef std::weak_ptr< const csl::Abstractweak_Expr_c
 
typedef const csl::AbstractParentParent_info
 
typedef const csl::TensorParentIParent_info
 
using Vector_alloc = std::allocator< Expr >
 
using vector_expr = std::vector< Expr >
 
using FactorType = std::pair< csl::Expr, std::vector< size_t > >
 
using iterator = std::vector< Expr >::iterator
 

Enumerations

enum  PrimaryType {
  Arbitrary =-1, PrimaryType::Numerical, PrimaryType::Literal, PrimaryType::MultiFunction =10,
  PrimaryType::ScalarFunction =20, PrimaryType::Vectorial =50, PrimaryType::Indicial =60, PrimaryType::Field =70
}
 Stores enumerations of types for Abstract objects. More...
 
enum  Type {
  InheritanceType =-2, Type::NoType =-1, Type::Integer, Type::Float,
  Type::IntFraction, Type::IntFactorial, Type::Complex, Type::NumericalEval,
  Type::Imaginary, Type::Constant, Type::Variable, Type::Exp,
  Type::Log, Type::DiracDelta, Type::Abs, Type::Cos,
  Type::Sin, Type::Tan, Type::Cosh, Type::Sinh,
  Type::Tanh, Type::ACos, Type::ASin, Type::ATan,
  Type::ACosh, Type::ASinh, Type::ATanh, Type::Scalar,
  Type::RealPart, Type::ImaginaryPart, Type::TensorElement, Type::ScalarField,
  Type::TensorFieldElement, TDerivativeElement, Type::StandardDuo, Type::StandardMult,
  Type::Pow, Type::Prod, Type::Sum, Type::Polynomial,
  Type::Derivative, Type::Commutator, Type::Angle, Type::Factorial,
  Type::Integral, Type::ScalarIntegral, Type::VectorIntegral, Type::Vector,
  Type::Matrix, Type::HighDTensor
}
 Enum of the different types of Abstract (i.e. list of all possible specializations). More...
 
enum  ComplexProperty { ComplexProperty::Complex, ComplexProperty::Real, ComplexProperty::Imaginary }
 Contains all possible complex properties of objects. Real, purely imaginary, or complex. More...
 

Functions

Expr sum_s (const Expr &leftOperand, const Expr &rightOperand, bool explicitSum=false)
 
Expr sum_s (const csl::vector_expr &operands, bool explicitSum=false)
 
Expr minus_ (const Expr &leftOperand, const Expr &rightOperand)
 Returns the sum of the two operands (with a minus sign), applying basic simplifications. More...
 
Expr prod_s (const Expr &leftOperand, const Expr &rightOperand, bool explicitProd=0)
 Returns the product of the two operands, applying basic simplifications. More...
 
Expr prod_s (const csl::vector_expr &operands, bool explicitProd=false)
 
Expr fraction_s (const Expr &leftOperand, const Expr &rightOperand)
 Returns the fraction of the two operands, applying basic simplifications. More...
 
Expr pow_s (const Expr &leftOperand, const Expr &rightOperand)
 Returns the exponentiation of the two operands, applying basic simplifications. More...
 
Expr pow_s (const Expr &leftOperand, int value)
 
Expr sqrt_s (const Expr &operand)
 
Expr sqrt_s (int number)
 
Expr derivative_s (const Expr &leftOperand, const Expr &rightOperand, int order=1)
 Returns the derivative of leftOperand wrt rightOperand, applying basic simplifications. More...
 
Expr derivative_s (const Expr &leftOperand, const Expr &rightOperand, int order, bool empty)
 
Expr derivative_s (const Expr &variable, int order=1)
 
Expr integral_s (const Expr &leftOperand, const Expr &rightOperand)
 
Expr integral_s (const Expr &leftOperand, const Expr &rightOperand, bool empty)
 
Expr integral_s (const Expr &leftOperand, const Expr &rightOperand, bool empty, const Expr &t_inf, const Expr &t_sup)
 
Expr integral_s (const Expr &variable)
 
Expr polynomial_s (const Expr &expr, const Expr &t_variable)
 
Expr polynomial_s (const csl::vector_expr &operands, const Expr &t_variable)
 
Expr operator+ (const Expr &a, const Expr &b)
 Shortcut function that allows to use arithmetic operator + with Expr (== shared_ptr<Abstract>). More...
 
Expr operator- (const Expr &a)
 
Expr operator- (const Expr &a, const Expr &b)
 Shortcut function that allows to use arithmetic operator - with Expr (== shared_ptr<Abstract>). More...
 
Expr operator* (const Expr &a, const Expr &b)
 Shortcut function that allows to use arithmetic operator * with Expr (== shared_ptr<Abstract>). More...
 
Expr operator/ (const Expr &a, const Expr &b)
 Shortcut function that allows to use arithmetic operator / with Expr (== shared_ptr<Abstract>). More...
 
std::ostream & operator<< (std::ostream &fout, const Expr &obj)
 
bool operator== (const Expr &a, const Expr &b)
 see Abstract::operator==()
 
bool operator!= (const Expr &a, const Expr &b)
 see Abstract::operator!=()
 
bool operator>= (const Expr &a, const Expr &b)
 see Abstract::operator>=()
 
bool operator<= (const Expr &a, const Expr &b)
 see Abstract::operator<=()
 
bool operator> (const Expr &a, const Expr &b)
 see Abstract::operator>()
 
bool operator< (const Expr &a, const Expr &b)
 see Abstract::operator<()
 
bool operator|= (const Expr &a, const Expr &b)
 see Abstract::operator|=()
 
bool operator &= (const Expr &a, const Expr &b)
 see Abstract::operator&=()
 
Expr FindLeaf (Expr const &init, Expr const &value, size_t depth=-1)
 Searches and returns an expression in another. More...
 
Expr FindNode (Expr const &init, Expr const &node, size_t depth=-1)
 Searches and returns an expression in another. More...
 
Expr FindIfLeaf (Expr const &init, std::function< bool(Expr const &)> const &f, size_t depth=-1)
 Searches and returns an expression in another. More...
 
Expr FindIfNode (Expr const &init, std::function< bool(Expr const &)> const &f, size_t depth=-1)
 Searches and returns an expression in another. More...
 
bool AnyOfLeafs (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1)
 Tells if any of the leafs of an expression respect a certain condition given by the user. More...
 
bool AnyOfLeafs (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1)
 
bool AllOfLeafs (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1)
 Tells if all of the leafs of an expression respect a certain condition given by the user. More...
 
bool AllOfLeafs (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1)
 
bool AnyOfNodes (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1)
 Tells if any of the nodes of an expression respect a certain condition given by the user. More...
 
bool AnyOfNodes (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1)
 
bool AllOfNodes (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1)
 Tells if all of the nodes of an expression respect a certain condition given by the user. More...
 
bool AllOfNodes (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1)
 
void VisitEachNode (Expr const &init, std::function< void(Expr const &)> const &f, int depth=-1)
 Visits all nodes of an expression, applying a function on it without modifying it. More...
 
void VisitEachNodeReversed (Expr const &init, std::function< void(Expr const &)> const &f, int depth=-1)
 
void VisitEachNode (Expr_info init, std::function< void(Expr_info)> const &f, int depth=-1)
 
void VisitEachLeaf (Expr const &init, std::function< void(Expr const &)> const &f, int depth=-1)
 Visits all leafs of an expression, applying a function on it without modifying it. More...
 
void VisitEachLeaf (Expr_info init, std::function< void(Expr_info)> const &f, int depth=-1)
 
void VisitEachNodeCut (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1)
 Visits all nodes of an expression, applying a function on it without modifying it. When the user function returns true on one node, the underlying branch (if there is) is not explored. More...
 
void VisitEachNodeCut (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1)
 
bool isUnique (csl::Expr const &expr)
 
size_t Count (csl::Expr const &expr, csl::Expr const &search)
 
size_t CountIf (csl::Expr const &expr, std::function< bool(csl::Expr const &)> const &f)
 
size_t CountNodes (Expr const &init)
 
size_t CountLeafs (Expr const &init)
 
void ForEachNode (Expr &init, std::function< void(Expr &)> const &f, int depth=-1)
 Applies a user function on each node of an expression. The expression may be modified. More...
 
void ForEachNodeReversed (Expr &init, std::function< void(Expr &)> const &f, int depth=-1)
 
void ForEachLeaf (Expr &init, std::function< void(Expr &)> const &f, int depth=-1)
 Applies a user function on each leaf of an expression. The expression may be modified. More...
 
void ForEachNodeCut (Expr &init, std::function< bool(Expr &)> const &f, int depth=-1)
 Applies a user function on each node of an expression. The expression may be modified. More...
 
bool FirstOfNode (Expr &init, std::function< bool(Expr &)> const &f)
 Tells if any of the nodes of an expression respect a certain condition given by the user. The condition function may apply on the go on the expression found. More...
 
bool FirstOfLeaf (Expr &init, std::function< bool(Expr &)> const &f)
 Tells if any of the leafs of an expression respect a certain condition given by the user. The condition function may apply on the go on the expression found. More...
 
bool VisitFirstOfNode (Expr const &init, std::function< bool(Expr const &)> const &f)
 
bool VisitFirstOfLeaf (Expr const &init, std::function< bool(Expr const &)> const &f)
 
bool Transform (Expr &init, std::function< bool(Expr &)> const &f, int depth=-1)
 Applies a user function on each node of an expression. The expression may be modified. If it is, the expression is refreshed. More...
 
template<class T , csl::allocator< T > & pool, class ... Args>
std::shared_ptr< T > make_shared (Args &&...args)
 
template<class T , class ... Args>
std::shared_ptr< T > make_shared (Args &&...args)
 
template<class T >
pointer_to_object (const Expr &expr)
 
template<class T >
T & pointer_to_object_ref (const Expr &expr)
 
template<typename T >
T * shared_to_raw_ptr (const Expr_c &expr)
 
template<typename T >
Expr object_to_shared (T &csl_expr)
 
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, and returns CSL_UNDEF else. Useful to test if two objects commute. More...
 
Expr Commutation (Expr_info A, Expr_info B, int sign=-1)
 
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, and returns CSL_UNDEF else. Useful to test if two objects commute. In the special of this function, A is an object that is not commutable (attribute Abstract::commutable) and B is commutable. More...
 
Expr WeakCommutation (Expr_info A, Expr_info B, int sign=-1)
 
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. More...
 
Expr real_s (const Expr &expr)
 
Expr imaginary_s (const Expr &expr)
 
Expr cconjugate_ (const Expr &expr)
 
template<class Iterator , class Comparator >
Iterator dichotomyFindIf (Iterator first, Iterator last, Comparator &&f)
 Template dichotomy algorithm using a comparator. More...
 
std::ostream & operator<< (std::ostream &fout, csl::Type type)
 Displays the name of a given csl::Type in order to be readable. More...
 
std::ostream & operator<< (std::ostream &fout, csl::PrimaryType primaryType)
 Displays the name of a given csl::PrimaryType in order to be readable. More...
 
std::ostream & operator<< (std::ostream &fout, cslEquation::Type type)
 
csl::vector_expr listBuildingBlocks (const Expr &expr)
 
Equationequation_ (const Expr &leftHandSide)
 
Equationequation_ (const Expr &leftHandSide, const Expr &rightHandSide)
 
Equationequation_ (const Equation &eq)
 
Equationequation_ (Equation *eq)
 
template<typename T >
void callError (cslError::Error error, const std::string &caller, T spec)
 Displays an error message depending on the error error, the name of the caller function caller and a possible specificity of the error spec. For example spec is the index for OutOfBound error. This function stops the program. More...
 
void callError (cslError::Error error, const std::string &caller)
 Calls callError(cslError::Error, const std::string&,T) with no spec.
 
template<typename T >
void callWarning (cslError::Warning warning, const std::string &caller, T spec)
 Displays a warning message depending on the warning warning, the name of the caller function caller and a possible specificity of the warning spec. For example spec is the dimension for InvalidDimension error. This function does not stop the program. More...
 
int matchBOnA (csl::Expr const &A, csl::Expr const &B)
 
bool hardComparison (csl::Expr const &, csl::Expr const &)
 
bool hardOrdering (csl::Expr const &, csl::Expr const &)
 
bool HardFactorImplementation (Expr &sum, bool applyRecursively=true)
 
Expr HardFactored (Expr const &init)
 
void HardFactor (Expr &init)
 
Expr DeepHardFactored (Expr const &init)
 
void DeepHardFactor (Expr &init)
 
std::vector< IndexintegerToIndices (const std::vector< int > &indices)
 
Index operator! (const Index &index)
 operator!, unary operator on Index that change the free property of the Index. More...
 
Index operator+ (const Index &index)
 operator+, unary operator on Index that returns a similar Index with sign = 1 if the Space is signed, i.e. an Index up. More...
 
Index operator- (const Index &index)
 operator-, unary operator on Index that returns a similar Index with sign = 0 if the Space is signed, i.e. an Index down. More...
 
csl::vector_expr getAllPermutations (const Expr &expr)
 
template<class ... Args>
std::shared_ptr< TensorParenttensor_s (Args &&...args)
 
template<class ... Args>
std::shared_ptr< TensorParenttensor_s (std::string const &name, std::vector< const Space *> const &indices, Args &&...args)
 
template<typename ... Args>
Expr tensorelement_s (Args &&...args)
 
bool IsIndicialTensor (const Expr &expr)
 
bool IsIndicialTensor (Expr_info expr)
 
void nameTensor (const std::string &name, Expr &tensor, bool first=true)
 Fills an tensor with variables of the same name with the numbers correponding to their place in the tensor. Allows for example to name elements of a vector $ V $: $ \left( V_0,V_1,V_2,V_3\right)$. More...
 
Expr generateTensor (const std::string &name, const std::vector< const Space *> &spaces)
 Generates a tensor of name name that lives in a list of spaces, filled with variables given by nameTensor(). More...
 
template<class T >
csl::Type GetType (T const &expr)
 
template<class T >
csl::Type GetPrimaryType (T const &expr)
 
size_t Size (Expr const &expr)
 
Expr GetArgument (Expr const &expr, size_t pos=0)
 
bool GetCommutable (csl::Expr const &expr)
 
bool GetCommutable (csl::Expr_info expr)
 
bool GetCommutable (csl::Abstract const &expr)
 
Expr GetSymbol (std::string_view name, Expr const &init)
 
Parent GetParent (std::string_view name, Expr const &init)
 
bool DependsOn (Expr const &init, Expr const &x)
 
bool DependsExplicitlyOn (Expr const &init, Expr const &x)
 
bool DependsOn (Expr const &init, csl::Parent const &x)
 
bool DependsExplicitlyOn (Expr const &init, csl::Parent const &x)
 
void Expand (Expr &expression, bool full=false, bool inplace=false)
 
Expr Expanded (const Expr &expression, bool full=false, bool inplace=false)
 
void ExpandIf (Expr &expression, std::function< bool(Expr const &)> const &f, bool full=false, bool inplace=false)
 
Expr ExpandedIf (const Expr &expression, std::function< bool(Expr const &)> const &f, bool full=false, bool inplace=false)
 
void DeepExpand (Expr &expression, bool inplace=false)
 
Expr DeepExpanded (Expr const &expression, bool inplace=false)
 
void DeepExpandIf (Expr &expression, std::function< bool(Expr const &)> const &f, bool inplace=false)
 
Expr DeepExpandedIf (Expr const &expression, std::function< bool(Expr const &)> const &f, bool inplace=false)
 
void DeepExpandIf_lock (Expr &expression, std::function< bool(Expr const &)> const &f, int lockId=0, bool inplace=false, bool refactor=false)
 
Expr DeepExpandedIf_lock (Expr const &expression, std::function< bool(Expr const &)> const &f, int lockId=0, bool inplace=false, bool refactor=false)
 
void Factor (Expr &expression, bool full=false)
 
void Factor (Expr &expression, Expr_info factor, bool full=false)
 
void Factor (Expr &expression, Expr const &factor, bool full=false)
 
Expr Factored (const Expr &expression, bool full=false)
 
Expr Factored (const Expr &expression, Expr_info factor, bool full=false)
 
Expr Factored (const Expr &expression, const Expr &factor, bool full=false)
 
void DeepFactor (Expr &expression)
 
void DeepFactor (Expr &expression, Expr_info factor)
 
void DeepFactor (Expr &expression, Expr const &factor)
 
Expr DeepFactored (const Expr &expression)
 
Expr DeepFactored (const Expr &expression, Expr_info factor)
 
Expr DeepFactored (const Expr &expression, const Expr &factor)
 
void Collect (Expr &expr, std::vector< Expr > const &factors)
 
void DeepCollect (Expr &expr, std::vector< Expr > const &factors)
 
Expr Collected (Expr const &expr, std::vector< Expr > const &factors)
 
Expr DeepCollected (Expr const &expr, std::vector< Expr > const &factors)
 
Expr Distributed (Expr const &expression, Expr_info factor, bool full=false)
 
void Distribute (Expr &expression, Expr_info factor, bool full=false)
 
Expr Distributed (Expr const &expression, Expr const &factor, bool full=false)
 
void Distribute (Expr &expression, Expr const &factor, bool full=false)
 
Expr DeepDistributed (Expr const &expression, Expr_info factor)
 
void DeepDistribute (Expr &expression, Expr_info factor)
 
Expr DeepDistributed (Expr const &expression, Expr const &factor)
 
void DeepDistribute (Expr &expression, Expr const &factor)
 
Expr Distributed (Expr const &expression, Parent_info factor, bool full=false)
 
void Distribute (Expr &expression, Parent_info factor, bool full=false)
 
Expr Distributed (Expr const &expression, Parent const &factor, bool full=false)
 
void Distribute (Expr &expression, Parent const &factor, bool full=false)
 
Expr DeepDistributed (Expr const &expression, Parent_info factor)
 
void DeepDistribute (Expr &expression, Parent_info factor)
 
Expr DeepDistributed (Expr const &expression, Parent const &factor)
 
void DeepDistribute (Expr &expression, Parent const &factor)
 
Expr DistributedIf (Expr const &expression, std::function< bool(Expr const &)> f, bool full=false)
 
void DistributeIf (Expr &expression, std::function< bool(Expr const &)> f, bool full=false)
 
Expr DeepDistributedIf (Expr const &expression, std::function< bool(Expr const &)> f)
 
void DeepDistributeIf (Expr &expression, std::function< bool(Expr const &)> f)
 
Expr GetTerm (const Expr &expression)
 
Expr Derived (const Expr &expression, Expr_info variable)
 
Expr Derived (const Expr &expression, const Expr &variable)
 
void Derive (Expr &expression, Expr_info variable)
 
void Derive (Expr &expression, const Expr &variable)
 
Expr GetPolynomialTerm (const Expr &expression, Expr_info variable, int order)
 
Expr GetPolynomialTerm (const Expr &expression, const Expr &variable, int order)
 
Expr Evaluated (const Expr &expression)
 
Expr Evaluated (const Expr &expression, csl::eval::mode user_mode)
 
void Evaluate (Expr &expr)
 
void Evaluate (Expr &expr, eval::mode user_mode)
 
ComplexProperty GetComplexProperty (Expr const &expr)
 
void SetComplexProperty (Expr &expr, ComplexProperty prop)
 
ComplexProperty GetComplexProperty (csl::Parent const &parent)
 
void SetComplexProperty (csl::Parent &parent, ComplexProperty prop)
 
template<class T >
void SetComplexProperty (T parent, ComplexProperty prop)
 
Expr GetRealPart (const Expr &expression)
 
Expr GetImaginaryPart (const Expr &expression)
 
Expr GetComplexModulus (const Expr &expression)
 
Expr GetComplexArgument (const Expr &expression)
 
Expr GetComplexConjugate (const Expr &expression)
 
Expr GetTransposed (const Expr &expression, const Space *space, bool applyProp=true)
 
Expr GetTransposed (const Expr &expression, const std::vector< const Space *> &spaces, bool applyProp=true)
 
Expr GetHermitianConjugate (const Expr &expression, const Space *space)
 
Expr GetHermitianConjugate (const Expr &expression, const std::vector< const Space *> &spaces)
 
Expr Swapped (const Expr &expression, const Index &index1, const Index &index2, bool refresh=true)
 
Expr Swapped (const Expr &expression, const Expr &index1, const Expr &index2, bool refresh=true)
 
Expr Swapped (const Expr &expression, const Parent &index1, const Parent &index2, bool refresh=true)
 
template<class T >
void Swap (Expr &expression, T const &old_obj, T const &new_obj)
 
Expr ContractIndex (const Expr &expression, const Index &index)
 
csl::Index GenerateIndex (const csl::Space *space, const std::string &name="")
 
csl::Tensor GetDelta (const csl::Space *space)
 
csl::Tensor GetMetric (const csl::Space *space)
 
csl::Tensor GetEpsilon (const csl::Space *space)
 
csl::Tensor GetDelta (const csl::Space &space)
 
csl::Tensor GetMetric (const csl::Space &space)
 
csl::Tensor GetEpsilon (const csl::Space &space)
 
Parent GetParent (Expr const &tensor)
 
Tensor GetTensorParent (Expr const &tensor)
 
TensorField GetTensorFieldParent (Expr const &tensor)
 
TDerivative GetTDerivativeParent (Expr const &tensor)
 
void AddSelfContraction (csl::Tensor &parent, Expr const &A, Expr const &B, Expr const &res)
 
void AddContractionProperty (csl::Tensor &parent, std::vector< Expr > const &tensors, Expr const &res)
 
void AddComplexProperty (csl::Tensor &parent, Expr const &A, Expr const &B)
 
void AddTransposedProperty (csl::Tensor &parent, csl::Space const *space, Expr const &A, Expr const &B)
 
void AddHermitianProperty (csl::Tensor &parent, csl::Space const *space, Expr const &A, Expr const &B)
 
LibDependency GetLibraryDependencies (Expr const &expression)
 
bool IsIndexed (Expr const &expr)
 
bool IsNumerical (Expr const &expr)
 
bool IsLiteral (Expr const &expr)
 
bool IsScalarFunction (Expr const &expr)
 
bool IsMultiFunction (Expr const &expr)
 
bool IsVectorial (Expr const &expr)
 
bool IsIndicial (Expr const &expr)
 
bool IsField (Expr const &expr)
 
bool IsArbitrary (Expr const &expr)
 
bool IsInteger (Expr const &expr)
 
bool IsFloat (Expr const &expr)
 
bool IsIntFraction (Expr const &expr)
 
bool IsIntFactorial (Expr const &expr)
 
bool IsComplex (Expr const &expr)
 
bool IsNumericalEval (Expr const &expr)
 
bool IsImaginary (Expr const &expr)
 
bool IsConstant (Expr const &expr)
 
bool IsVariable (Expr const &expr)
 
bool IsExp (Expr const &expr)
 
bool IsLog (Expr const &expr)
 
bool IsDiracDelta (Expr const &expr)
 
bool IsAbs (Expr const &expr)
 
bool IsCos (Expr const &expr)
 
bool IsSin (Expr const &expr)
 
bool IsTan (Expr const &expr)
 
bool IsCosh (Expr const &expr)
 
bool IsSinh (Expr const &expr)
 
bool IsTanh (Expr const &expr)
 
bool IsACos (Expr const &expr)
 
bool IsASin (Expr const &expr)
 
bool IsATan (Expr const &expr)
 
bool IsACosh (Expr const &expr)
 
bool IsASinh (Expr const &expr)
 
bool IsATanh (Expr const &expr)
 
bool IsScalar (Expr const &expr)
 
bool IsRealPart (Expr const &expr)
 
bool IsImaginaryPart (Expr const &expr)
 
bool IsITensor (Expr const &expr)
 
bool IsScalarField (Expr const &expr)
 
bool IsTensorField (Expr const &expr)
 
bool IsTensorialDerivative (Expr const &expr)
 
bool IsStandardDuo (Expr const &expr)
 
bool IsStandardMult (Expr const &expr)
 
bool IsPow (Expr const &expr)
 
bool IsProd (Expr const &expr)
 
bool IsSum (Expr const &expr)
 
bool IsPolynomial (Expr const &expr)
 
bool IsDerivative (Expr const &expr)
 
bool IsCommutator (Expr const &expr)
 
bool IsAngle (Expr const &expr)
 
bool IsFactorial (Expr const &expr)
 
bool IsIntegral (Expr const &expr)
 
bool IsScalarIntegral (Expr const &expr)
 
bool IsVectorIntegral (Expr const &expr)
 
bool IsVector (Expr const &expr)
 
bool IsMatrix (Expr const &expr)
 
bool IsHighDTensor (Expr const &expr)
 
bool IsIndexed (Expr_info expr)
 
bool IsNumerical (Expr_info expr)
 
bool IsLiteral (Expr_info expr)
 
bool IsScalarFunction (Expr_info expr)
 
bool IsMultiFunction (Expr_info expr)
 
bool IsVectorial (Expr_info expr)
 
bool IsIndicial (Expr_info expr)
 
bool IsField (Expr_info expr)
 
bool IsArbitrary (Expr_info expr)
 
bool IsInteger (Expr_info expr)
 
bool IsFloat (Expr_info expr)
 
bool IsIntFraction (Expr_info expr)
 
bool IsIntFactorial (Expr_info expr)
 
bool IsComplex (Expr_info expr)
 
bool IsNumericalEval (Expr_info expr)
 
bool IsImaginary (Expr_info expr)
 
bool IsConstant (Expr_info expr)
 
bool IsVariable (Expr_info expr)
 
bool IsExp (Expr_info expr)
 
bool IsLog (Expr_info expr)
 
bool IsDiracDelta (Expr_info expr)
 
bool IsAbs (Expr_info expr)
 
bool IsCos (Expr_info expr)
 
bool IsSin (Expr_info expr)
 
bool IsTan (Expr_info expr)
 
bool IsCosh (Expr_info expr)
 
bool IsSinh (Expr_info expr)
 
bool IsTanh (Expr_info expr)
 
bool IsACos (Expr_info expr)
 
bool IsASin (Expr_info expr)
 
bool IsATan (Expr_info expr)
 
bool IsACosh (Expr_info expr)
 
bool IsASinh (Expr_info expr)
 
bool IsATanh (Expr_info expr)
 
bool IsScalar (Expr_info expr)
 
bool IsRealPart (Expr_info expr)
 
bool IsImaginaryPart (Expr_info expr)
 
bool IsITensor (Expr_info expr)
 
bool IsScalarField (Expr_info expr)
 
bool IsTensorField (Expr_info expr)
 
bool IsTensorialDerivative (Expr_info expr)
 
bool IsStandardDuo (Expr_info expr)
 
bool IsStandardMult (Expr_info expr)
 
bool IsPow (Expr_info expr)
 
bool IsProd (Expr_info expr)
 
bool IsSum (Expr_info expr)
 
bool IsPolynomial (Expr_info expr)
 
bool IsDerivative (Expr_info expr)
 
bool IsCommutator (Expr_info expr)
 
bool IsAngle (Expr_info expr)
 
bool IsFactorial (Expr_info expr)
 
bool IsIntegral (Expr_info expr)
 
bool IsScalarIntegral (Expr_info expr)
 
bool IsVectorIntegral (Expr_info expr)
 
bool IsVector (Expr_info expr)
 
bool IsMatrix (Expr_info expr)
 
bool IsHighDTensor (Expr_info expr)
 
void ApplySelfProperty (Expr &init, csl::Tensor &tensor, Expr const &A, Expr const &B, Expr const &res)
 Declares a self contraction property just the time of a refresh in order to apply it on one expression. More...
 
void ApplyChainProperty (Expr &init, csl::Tensor &tensor, std::vector< Expr > const &prod, Expr const &res)
 Declares a chain contraction property just the time of a refresh in order to apply it on one expression. More...
 
bool CheckValidity (Expr const &init, std::vector< Expr_info > encountered=std::vector< Expr_info >())
 Checks the validity of an expression. More...
 
size_t MemorySizeOf (Expr const &expression)
 Calculates an estimate of the total memory that an expression takes. More...
 
void AddProperty (csl::Tensor &tensor, Expr const &A, Expr const &B, Expr const &res)
 
void AddProperty (csl::Tensor &tensor, std::vector< Expr > const &product, Expr const &res)
 
const csl::SpaceGetSpace (csl::Tensor const &tensor, int pos=0)
 
csl::Index GetIndex (csl::Tensor const &tensor, int pos=0)
 
csl::Index GetIndex (csl::Space const *space)
 
std::vector< csl::IndexGetIndices (size_t N, csl::Space const *space)
 
csl::Index GetIndex (csl::Space const &space)
 
std::vector< csl::IndexGetIndices (size_t N, csl::Space const &space)
 
std::vector< csl::IndexGetIndices (size_t N, csl::Tensor const &tensor, int pos=0)
 
std::vector< csl::IndexGetFullSetOfIndicesFor (csl::Tensor const &tensor)
 
Tensor Unitary (std::string const &name, csl::Space const *space)
 
bool TestIndexSanity (Expr const &expr, bool verbose=false)
 
void printCallableStructure (std::ostream &out)
 
void print_libcomplexop_hdata (std::ostream &out)
 
void print_libdiagonalization_cppdata (std::ostream &out)
 
void print_libdiagonalization_hdata (std::ostream &out)
 
std::ostream & operator<< (std::ostream &out, LibEvalSession::Perf perf)
 
bool operator< (LibParameter const &A, LibParameter const &B)
 
std::vector< LibParameterinputParams (std::vector< LibraryGenerator::DiagonalizationData > const &diagData)
 
std::vector< LibParameteroutputParams (std::vector< LibraryGenerator::DiagonalizationData > const &diagData, std::vector< std::string > const &massExpressions)
 
void print_librarytensor_hdata (std::ostream &out)
 
Expr intfactorial_s (int value)
 
Expr constant_s (std::string const &name, csl::ComplexProperty prop=csl::ComplexProperty::Real)
 
Expr constant_s (std::string const &name, long double value, csl::ComplexProperty prop=csl::ComplexProperty::Real)
 
Expr constant_s (std::string const &name, Expr const &value, csl::ComplexProperty prop=csl::ComplexProperty::Real)
 
Expr variable_s (std::string const &name, csl::ComplexProperty prop=csl::ComplexProperty::Real)
 
Expr variable_s (std::string const &name, long double value, csl::ComplexProperty prop=csl::ComplexProperty::Real)
 
Expr variable_s (std::string const &name, Expr const &value, csl::ComplexProperty prop=csl::ComplexProperty::Real)
 
Expr abs_s (const Expr &expr)
 Creates an object of type Abs acting on expr. More...
 
Expr exp_s (const Expr &expr)
 Creates an object of type Exp acting on expr. More...
 
Expr log_s (const Expr &expr)
 Creates an object of type Log acting on expr. More...
 
Expr cos_s (const Expr &expr)
 Creates an object of type Cos acting on expr. More...
 
Expr sin_s (const Expr &expr)
 Creates an object of type Sin acting on expr. More...
 
Expr tan_s (const Expr &expr)
 Creates an object of type Tan acting on expr. More...
 
Expr acos_s (const Expr &expr)
 Creates an object of type ACos acting on expr. More...
 
Expr asin_s (const Expr &expr)
 Creates an object of type ASin acting on expr. More...
 
Expr atan_s (const Expr &expr)
 Creates an object of type ATan acting on expr. More...
 
Expr angle_s (Expr const &a, Expr const &b)
 
Expr cosh_s (const Expr &expr)
 Creates an object of type Cosh acting on expr. More...
 
Expr sinh_s (const Expr &expr)
 Creates an object of type Sinh acting on expr. More...
 
Expr tanh_s (const Expr &expr)
 Creates an object of type Tanh acting on expr. More...
 
Expr acosh_s (const Expr &expr)
 Creates an object of type ACosh acting on expr. More...
 
Expr asinh_s (const Expr &expr)
 Creates an object of type ASinh acting on expr. More...
 
Expr atanh_s (const Expr &expr)
 Creates an object of type ATanh acting on expr. More...
 
Expr factorial_s (const Expr &expr)
 
Expr diracdelta_s (const Expr &argument)
 
Expr float_s (long double value)
 
Expr int_s (long long int value)
 
Expr autonumber_s (long double value)
 
Expr intfraction_s (long long int num, long long int denom)
 
Expr complex_s (Expr const &real, Expr const &imag)
 
Expr numericaleval_s (long double value, long double delta_plus)
 
Expr numericaleval_s (long double value, long double delta_plus, long double delta_minus)
 
template<class T >
std::ostream & operator<< (std::ostream &fout, const ObjectPermutation< T > &perm)
 
template<class T >
std::ostream & operator<< (std::ostream &fout, const ObjectSymmetry< T > &sym)
 
void getExponentStructure (const Expr &argument, Expr &term, Expr &exponent)
 
void applyOperator (Expr &product)
 
Expr tensor_s (const std::vector< int > &shape, const Expr &filler)
 
bool pullLeft (csl::vector_expr &argument, size_t pos, size_t &begin)
 
bool pullRight (csl::vector_expr &argument, size_t &pos, size_t &end)
 
void getParts (const csl::vector_expr &argument, size_t begin, size_t end, Expr &left, Expr &mid, Expr &right)
 
bool haveCommonIndices (csl::Expr const &a, csl::Expr const &b, csl::Space const *space)
 
void PartialExpandImplementation (Expr &prod, ExpanderEmitter const &isEmitter, ExpanderReceiver const &isReceiver)
 
void PartialExpandImplementation (Expr &prod, ExpanderEmitter const &isEmitter, ExpanderEmitter const &isReceiver)
 
void PartialExpandImplementation (Expr &prod, ExpanderEmitter const &isEmitterReceiver)
 
Expr PartialExpanded (Expr const &init, ExpanderEmitter const &isEmitter, ExpanderReceiver const &isReceiver)
 
void PartialExpand (Expr &init, ExpanderEmitter const &isEmitter, ExpanderReceiver const &isReceiver)
 
Expr DeepPartialExpanded (Expr const &init, ExpanderEmitter const &isEmitter, ExpanderReceiver const &isReceiver)
 
void DeepPartialExpand (Expr &init, ExpanderEmitter const &isEmitter, ExpanderReceiver const &isReceiver)
 
Expr PartialExpanded (Expr const &init, ExpanderEmitter const &isEmitter, ExpanderEmitter const &isReceiver)
 
void PartialExpand (Expr &init, ExpanderEmitter const &isEmitter, ExpanderEmitter const &isReceiver)
 
Expr DeepPartialExpanded (Expr const &init, ExpanderEmitter const &isEmitter, ExpanderEmitter const &isReceiver)
 
void DeepPartialExpand (Expr &init, ExpanderEmitter const &isEmitter, ExpanderEmitter const &isReceiver)
 
Expr PartialExpanded (Expr const &init, ExpanderEmitter const &isEmitter)
 
void PartialExpand (Expr &init, ExpanderEmitter const &isEmitter)
 
Expr DeepPartialExpanded (Expr const &init, ExpanderEmitter const &isEmitter)
 
void DeepPartialExpand (Expr &init, ExpanderEmitter const &isEmitter)
 
std::pair< int_ap< 2 >, int > decomposeLongFloat (long double number)
 
void fillDigits (const std::vector< short > &digits, std::vector< short > &receiver)
 
template<const size_t base>
long double log (long double x)
 
char convertDigit (short digit)
 
template<size_t base>
int_ap< base > factorial (const int_ap< base > &number)
 
void MakeIntegral (Expr &init)
 
template<typename ... Args>
Expr scalarintegral_s (Args ...args)
 
Expr vectorintegral_s (const Tensor &variables)
 
template<typename ... Args>
Expr vectorintegral_s (const Expr &operand, const Tensor &variables, Args... args)
 
template<typename ... Args>
Expr vectorintegral_s (const Tensor &variables, Args... args)
 
Expr vectorintegral_s (const Parent &variables)
 
template<typename ... Args>
Expr vectorintegral_s (const Expr &operand, const Parent &variables, Args... args)
 
template<typename ... Args>
Expr vectorintegral_s (const Parent &variables, Args... args)
 
void Replace (csl::Expr &expr, csl::Expr const &from, csl::Expr const &to)
 
void Replace (csl::Expr &expr, csl::Parent const &from, csl::Parent const &to)
 
void Replace (csl::Expr &expr, csl::Parent const &from, csl::Expr const &to)
 
void Replace (csl::Expr &expr, std::vector< csl::Parent > const &from, std::vector< csl::Parent > const &to)
 
void Replace (csl::Expr &expr, std::vector< csl::Expr > const &from, std::vector< csl::Expr > const &to)
 
void ReplaceIndicial (csl::Expr &expr, std::vector< csl::Expr > const &from, std::vector< csl::Expr > const &to)
 
void Replace (csl::Expr &expr, std::vector< csl::Parent > const &from, std::vector< csl::Expr > const &to, bool refresh=true)
 
template<class T , class U , class ... Params, typename = std::enable_if_t< !csl::canDecay_v<T, U, csl::Index> && !csl::canDecay_v<T, U, csl::IndexStructure> && !csl::canDecay_v<T, U, std::vector<csl::Index>> >>
csl::Expr Replaced (csl::Expr const &expr, T &&p1, U &&p2, Params &&...params)
 
csl::Expr Replaced (csl::Expr const &expr, csl::Index const &from, csl::Index const &to, bool refresh=true)
 
void Replace (csl::Expr &expr, csl::Index const &from, csl::Index const &to, bool refresh=true)
 
csl::Expr Replaced (csl::Expr const &expr, std::vector< csl::Index > const &from, std::vector< csl::Index > const &to, bool refresh=true)
 
void Replace (csl::Expr &expr, std::vector< csl::Index > const &from, std::vector< csl::Index > const &to, bool refresh=true)
 
csl::Expr Replaced (csl::Expr const &expr, csl::IndexStructure const &from, csl::IndexStructure const &to, bool refresh=true)
 
void Replace (csl::Expr &expr, csl::IndexStructure const &from, csl::IndexStructure const &to, bool refresh=true)
 
auto ruleToPredicate (replacementRule const &rule)
 Converts a replacementRule into a predicate. More...
 
bool hasWeakDependency (csl::Expr const &expr, std::function< bool(csl::Expr const &)> const &predicate)
 Search for a true value for a given predicate in an expression, considering also sub-expressions encapsulated by abbreviations. More...
 
void applyThroughAbbreviations (csl::Expr &expr, replacementRule const &rule)
 Applies a replacement rule thoughout an expression, also entering abbreviations and replacing them if a replacement is found. More...
 
std::optional< csl::ExprscalarReplacement (csl::Expr const &expr, std::vector< csl::Expr > const &from, std::vector< csl::Expr > const &ccFrom, std::vector< csl::Expr > const &to, bool isPredicate)
 
std::optional< csl::ExprindicialReplacement (csl::Expr const &expr, std::vector< csl::Expr > const &from, std::vector< csl::Parent_info > const &parentFrom, std::vector< csl::Expr > const &to, bool isPredicate)
 
std::optional< csl::ExprtensorReplacement (csl::Expr const &expr, std::vector< csl::Parent > const &from, std::vector< csl::Parent > const &to, bool isPredicate)
 
std::optional< csl::ExprtensorExpressionReplacement (csl::Expr const &expr, std::vector< csl::Parent > const &from, std::vector< csl::Expr > const &to, bool isPredicate)
 
void ResetDummyIndices (csl::Expr &expr)
 
void ApplyIndices (csl::Expr &expr, csl::IndexStructure const &structure)
 
void ApplyIndices (csl::Expr &expr, csl::IndexStructure const &from, csl::IndexStructure const &to)
 
void renameIndex (csl::Index &index, std::map< csl::Index, csl::Index > &mapping)
 
void RenameIndices (csl::Expr &expr)
 
csl::Expr RenamedIndices (csl::Expr const &expr)
 
void internal_RenameIndices (csl::Expr &expr, std::map< csl::Index, csl::Index > &mapping)
 
template<class ParentType , typename = std::enable_if_t<std::is_convertible_v<ParentType, Parent>>>
void Replace (Expr &expr, std::vector< ParentType > const &t_from, std::vector< ParentType > const &t_to)
 
template<class ParentType , typename = std::enable_if_t<std::is_convertible_v<ParentType, Parent>>>
void Replace (Expr &expr, std::vector< ParentType > const &t_from, std::vector< csl::Expr > const &to)
 
template<class ... Args>
Expr Tried (const Expr &expr, Args &&...args)
 
template<class ... Args>
void Try (Expr &expr, Args &&...args)
 
Expr scalar_ (Expr const &left, Expr const &right)
 
void printVector (const csl::vector_expr &vector)
 Display a vector of expressions. Useful in debug. More...
 
void addAlternateForm (csl::vector_expr &alternateForms, const Expr &newAlternate, bool add_factor_expand=true)
 Tried to add newAlternate in the set alternateForms. We simply test if the alternate is already present in the set newAlternate and add it if it is not the case. If add_factor_expand is set to true, we try to add the expanded and the factored forms of newAlternate. More...
 
void reduceAlternate (csl::vector_expr &alternateForms)
 Reduces the number of elements in alternateForms to MAX_ALTERNATE_FORMS. More...
 
void clearRedundancyAlternate (csl::vector_expr &alternateForms)
 Search and remove redundancies (equal alternate forms) in alternateForms. More...
 
csl::vector_expr getRecursiveAlternateForms (const Expr &expr, int depth=-1)
 Returns the alternate forms of expr by applying recursively internalRecursiveAlternateForms() MAX_RECURSION_ALTERNATE times: take alternates, then alternates of the alternates etc. More...
 
csl::vector_expr internalRecursiveAlternateForms (const Expr &expr, int depth=-1)
 Calculates and return all alternate forms of expr, by getting (once) alternate forms of the possible arguments of expr, and then the specific alternates of expr. More...
 
Expr Simplify (const Expr &expr, int depth=-1)
 Simplifies expr depending on its type. More...
 
int numberOfMutatingNodes (const Expr &expr)
 
bool insertSortMutant (csl::vector_expr &vec, const Expr &newExpr)
 
bool addMutants (csl::vector_expr &individuals, const csl::vector_expr &mutants)
 
csl::vector_expr getRandomMutation (const Expr &expr)
 
void naturalSelection (csl::vector_expr &individuals)
 
Expr evolve (const Expr &baseIndividual)
 
void sort (std::vector< Expr > &argument)
 Sorts a container using mergeSort(). More...
 
void sort (std::vector< Expr >::iterator first, std::vector< Expr >::iterator last)
 Sorts a container using mergeSort(). More...
 
void selectionSort (std::vector< Expr > &argument)
 Applies the selection sort algorithm $ \mathcal{O}(N^2) $ on a container. More...
 
void selectionSort (std::vector< Expr >::iterator first, std::vector< Expr >::iterator last)
 Applies the selection sort algorithm $ \mathcal{O}(N^2) $ on a container. More...
 
void mergeSort (std::vector< Expr > &argument)
 Applies the merge sort algorithm $ \mathcal{O}(N\log N) $ on a container. More...
 
void mergeSort (std::vector< Expr >::iterator first, std::vector< Expr >::iterator last)
 Applies the merge sort algorithm $ \mathcal{O}(N\log N) $ on a container. More...
 
template<typename T , typename G >
std::vector< std::pair< T, G > >::iterator findFirstInPair (std::vector< std::pair< T, G >> &v, const T &element)
 
template<typename T , typename G >
std::vector< std::pair< T, G > >::iterator findSecondInPair (std::vector< std::pair< T, G >> &v, const G &element)
 
const SpacebuildMinkowski ()
 
void fillEpsilonTensor (Expr &tensor, int dim)
 
const Space Euclid_R2 ("R2", 2)
 Space $ R^2 $.
 
const Space Euclid_R3 ("R3", 3)
 Space $ R^3 $.
 
const Space Euclid_R4 ("R4", 4)
 Space $ R^4 $.
 
int PGCD (double a, double b)
 Returns the PGCD of a and b. More...
 
long long int PGCD (long long int a, long long int b)
 Returns the PGCD of a and b. More...
 
int PGCD (int a, int b)
 
int internal_PGCD (long long int a, long long int b)
 Returns the PGCD of a and b. More...
 
long long int sgn (long long int a)
 Returns the sign of a. More...
 
int sgn (int a)
 
int sgn (double a)
 Returns the sign of a. More...
 
double factorial (int n)
 Returns the factorial of a. More...
 
long long int internal_factorial (long long int n)
 Returns the factorial of a. More...
 
int compare (std::string_view a, std::string_view b)
 
bool operator> (const std::string &a, const std::string &b)
 
bool operator< (const std::string &a, const std::string &b)
 
bool operator>= (const std::string &a, const std::string &b)
 
bool operator<= (const std::string &a, const std::string &b)
 
std::vector< size_t > range (size_t n)
 
std::vector< size_t > range (size_t i, size_t n)
 
std::vector< size_t > range (size_t i, size_t n, size_t step)
 
template<typename T >
bool comparePlaceIndependant (std::vector< T > A, std::vector< T > B)
 Template function that compares the elements in two vectors A and B, independently on their order. More...
 
template<typename T >
bool partialComparePlaceIndependant (std::vector< T > A, std::vector< T > B)
 Template function that compares the elements in two vectors A and B, independently on their order, A can be bigger, this function determines if all elements in B are present in A. More...
 
std::vector< std::vector< int > > permutations (std::vector< int > init)
 Gets all permutations (int the form of vectors of integers) of n elements, n beeing the size of init. The vector init must contain all integers between 0 and n-1. More...
 
std::vector< Permutationpermutations (const Permutation &init)
 Gets all permutations (int the form of Permutation objects) of n elements, n beeing the size of init. More...
 
void reducePermutation (std::vector< Permutation > &permutation)
 Takes a vector of Permutation objects and erase the redundant ones, i.e. the permutations present several times in the vector. More...
 
std::vector< PermutationgetSpan (const std::vector< Permutation > &init)
 Calculates all permutations spanned by an ensemble of initial Permutations init. More...
 
void getSpan (std::vector< Permutation > &spanned, const Permutation &element)
 This function adds an element in an already complete set of permutations. It assumes that the std::vector spanned is already complete by itself and modifies it by adding all the permutations spanned by itself and the new permutation element. More...
 
template<class ... Args>
std::shared_ptr< TensorFieldParenttensorfield_s (Args &&...args)
 
template<class ... Args>
std::shared_ptr< TensorFieldParenttensorfield_s (std::string const &name, csl::Space const *spaceField, std::vector< const Space *> const &indices, Args &&...args)
 
template<typename ... Args>
Expr tensorfieldelement_s (Args &&...args)
 
Expr tderivativeelement_s (const Tensor &t_vector, const Parent &t_parent, const Index &t_index)
 
Expr tderivativeelement_s (const Tensor &t_vector, const Parent &t_parent, const Index &t_index, const Expr &t_operand, bool t_empty)
 
template<class ... Args>
std::shared_ptr< TDerivativeParenttderivative_s (Args &&...args)
 
std::vector< ExprInverseTaylorExpand (Expr const &init, Expr const &big, size_t order)
 
std::vector< ExprTaylorExpand (Expr const &init, Expr const &eps, size_t order)
 
std::vector< Exprinternal_TaylorExpand (Expr const &init, Expr const &eps, size_t order)
 
Expr Copy (const Abstract *expr)
 See Copy(const Expr& expr). More...
 
Expr CopySelf (Abstract *expr)
 
Expr Copy (const Expr &expr)
 Copy an Abstract to depth 1. More...
 
Expr DeepCopy (const Abstract *expr)
 See DeepCopy(const Expr& expr). More...
 
Expr DeepCopy (const Expr &expr)
 Copy an Abstract to the maximum depth. More...
 
void WeakDeepCopy (Expr &expr)
 
Expr Refreshed (const Abstract *expr)
 See Refreshed(const Expr& expr). More...
 
Expr Refreshed (const Expr &expr)
 Refreshed an Abstract and apply basic simplifications. More...
 
Expr DeepRefreshed (const Expr &expr)
 Refreshed recursively an Abstract and apply basic simplifications. More...
 
void Refresh (Expr &expr)
 
void DeepRefresh (Expr &expr)
 
Expr vector_s (int t_nElements)
 
Expr vector_s (int t_nElements, const Expr &expr)
 
Expr vector_s (int t_nElements, const Expr &expr, const Expr &index)
 
Expr vector_s (const csl::vector_expr &t_argument)
 
Expr vector_s (const std::initializer_list< Expr > &t_argument)
 
Expr matrix_s (int t_nArgs)
 
Expr matrix_s (int t_x_nArgs, int t_y_nArgs)
 
Expr matrix_s (int t_x_nArgs, int t_y_nArgs, const Expr &expr, const Expr &index_x, const Expr &index_y)
 
Expr matrix_s (int t_x_nArgs, int t_y_nArgs, const Expr &expr)
 
Expr matrix_s (const csl::vector_expr &t_argument)
 
Expr matrix_s (const std::initializer_list< std::initializer_list< Expr > > &t_matrix)
 
Expr diagonal_s (const csl::vector_expr &diag)
 
Expr identity_s (int dim)
 
Expr highdtensor_s (const std::vector< int > &shape)
 
Expr highdtensor_s (const std::vector< int > &shape, const Expr &filler)
 
Expr highdtensor_s (const std::initializer_list< std::initializer_list< std::initializer_list< Expr > > > &t_tensor)
 
Expr highdtensor_from_args_s (const std::vector< Expr > &args)
 
Expr vectorialtensor_s (const std::vector< int > &shape)
 
Expr vectorialtensor_s (const std::vector< int > &shape, const Expr &filler)
 
bool compareString (std::string_view a, std::string_view b)
 
size_t dichoFinder (csl::Expr const &expr, std::vector< AbstractParent *> const &v)
 
Expr termWithoutExponent (Expr const &expr)
 
bool operator== (const Expr &a, int b)
 
bool operator!= (const Expr &a, int b)
 
bool operator!= (const Expr &a, double b)
 
void ForEachNode (std::vector< Expr > init, std::function< void(Expr &)> const &f, int depth)
 
void ForEachLeaf (std::vector< Expr > init, std::function< void(Expr &)> const &f, int depth)
 
csl::vector_expr applyProperties (const csl::vector_expr &alternateForms)
 
Expr findCommonFactor (std::vector< Expr *> const &expressions)
 
ostream & operator<< (ostream &fout, csl::Type type)
 
ostream & operator<< (ostream &fout, csl::PrimaryType primaryType)
 
ostream & operator<< (ostream &fout, const Equation &eq)
 
ostream & operator<< (ostream &fout, cslEquation::Type type)
 
template<class ... T_Args>
std::ostream & operator<< (std::ostream &out, Functional< T_Args... > func)
 
int matchBOnA (csl::Expr &B, std::vector< csl::Expr > const &tensorsInA, std::vector< csl::Expr > const &tensorsInB)
 
int matchBOnA (csl::Expr const &A, csl::Expr &B)
 
int isSuperFactor (Expr const &fL, Expr const &fR)
 
size_t nSimilar (std::vector< size_t > const &sortedA, std::vector< size_t > const &sortedB)
 
size_t maxSimilarity (std::vector< size_t > const &pos, csl::linear_map< csl::Expr, std::vector< size_t >> const &m)
 
FactorType const * getBestFactor (csl::linear_map< csl::Expr, std::vector< size_t >> const &m)
 
std::pair< bool, bool > hasRecursiveFactors (FactorType const *best, csl::linear_map< csl::Expr, std::vector< size_t >> const &m)
 
csl::linear_map< csl::Expr, std::vector< size_t > >::iterator linear_find (csl::linear_map< csl::Expr, std::vector< size_t >> &m, csl::Expr const &expr)
 
ostream & operator<< (ostream &fout, const Index &index)
 
ostream & operator<< (ostream &fout, const IndexStructure &structure)
 
void nameTensor (const string &name, Expr &tensor, bool first)
 
Expr generateTensor (const string &name, const vector< const Space *> &spaces)
 
ostream & operator<< (ostream &fout, const SelfContraction &c)
 
bool isInContraction (std::vector< std::array< int, 4 >> const &contractions, int iTensor, int iIndex)
 
ostream & operator<< (ostream &fout, const ContractionChain &c)
 
template<typename T >
vector< pair< T, Expr > >::iterator findContraction (typename vector< pair< T, Expr >>::iterator it, typename vector< pair< T, Expr >>::iterator last, T element)
 
template<typename T >
vector< pair< T, Expr > >::const_iterator findContraction (typename vector< pair< T, Expr >>::const_iterator it, typename vector< pair< T, Expr >>::const_iterator last, T element)
 
void fillKeptIndices (vector< vector< vector< int >>> &keptIndices, vector< size_t >::const_iterator posBroken, vector< size_t >::const_iterator endPosBroken, vector< vector< int >> const &toInsert)
 
void fillKeptIndices (vector< vector< vector< int >>> &keptIndices, vector< size_t >::const_iterator posBroken, vector< size_t >::const_iterator endPosBroken, vector< size_t > const &pieces)
 
void fillNewSpaces (vector< vector< const Space *>> &newSpace, vector< size_t >::const_iterator posBroken, vector< size_t >::const_iterator endPosBroken, vector< const Space *> const &fillingSpace)
 
vector< vector< const Space * > > fillNewSpaces (vector< const Space *> const &init, vector< size_t >::const_iterator posBroken, vector< size_t >::const_iterator endPosBroken, vector< const Space *> const &fillingSpace)
 
std::string getBrokenName (std::string const &initName, std::vector< std::vector< int >> const &indices)
 
std::ostream & operator<< (std::ostream &fout, const TensorParent &i)
 
void fillStructures (vector< IndexStructure > &toFill, const vector< Index > &indices, vector< size_t >::const_iterator pos, vector< size_t >::const_iterator end, size_t iter=0)
 
void clearNullIndices (vector< IndexStructure > &toClear)
 
void uniformizeIndices (csl::vector_expr &terms)
 
void keep_duplicates (vector< Index > &vec)
 
void contract (Expr &arg1, Expr &arg2, csl::Index const &index1, csl::Index const &index2)
 
void fillPosition (vector< vector< size_t >> &positions, size_t Nspaces)
 
Expr getBrokenExpr (const Expr &init, const csl::vector_expr &brokenExpr, const vector< Index > &brokenIndices, const vector< Index > &replacement, const vector< size_t > &positions, const size_t Nspaces)
 
std::vector< ExprsumDummyIndices (std::vector< Expr > const &init, std::vector< std::vector< size_t >> const &posIndices, std::vector< size_t > const &dummyIndices)
 
void sortIndices (std::vector< csl::Index > &indices, std::vector< size_t > &positions)
 
Expr GetTransposed (const Expr &expression, const vector< const Space *> &spaces, bool applyProp)
 
Expr GetHermitianConjugate (const Expr &expression, const vector< const Space *> &spaces)
 
csl::IndexStructure getFullStructure (Expr const &expr)
 
bool isTensorName (std::string_view name)
 
std::ostream & operator<< (std::ostream &out, LibEval const &eval)
 
LibEval findEvalDicho (int id, std::vector< LibEval >::const_iterator first, std::vector< LibEval >::const_iterator last)
 
LibEval exprToEval (Expr const &expr, std::vector< LibEval > const &eval)
 
bool independent (LibEval const &A, LibEval const &B)
 
size_t getNLeafs (csl::Expr const &expr)
 
std::ostream & operator<< (std::ostream &out, Structure const &s)
 
Expr constant_s (string const &name, csl::ComplexProperty prop)
 
Expr constant_s (string const &name, long double value, csl::ComplexProperty prop)
 
Expr constant_s (string const &name, Expr const &value, csl::ComplexProperty prop)
 
Expr variable_s (string const &name, csl::ComplexProperty prop)
 
Expr variable_s (string const &name, long double value, csl::ComplexProperty prop)
 
Expr variable_s (string const &name, Expr const &value, csl::ComplexProperty prop)
 
void testSimplificationRule (std::vector< Expr > const &arg)
 
std::ostream & operator<< (std::ostream &fout, const AbstractParent &parent)
 
bool alreadyInChain (size_t pos, std::vector< ExpansionChain > const &chains)
 
csl::Expr const * getEmitter (csl::Expr const &expr, ExpanderEmitter const &isEmitter)
 
bool any_of (csl::Expr const *emi, csl::Expr const &rec, ExpanderReceiver const &isReceiver)
 
size_t getNTerms (csl::Expr const &prod, ExpansionChain const &toExpand, ExpanderReceiver const &isReceiver)
 
csl::Expr applyExpansion (csl::Expr const &prod, ExpansionChain const &toExpand, ExpanderEmitter const &isEmitter, ExpanderReceiver const &isReceiver, bool applyRecursively)
 
bool hasCommonIndex (std::vector< size_t > const &sortedA, std::vector< size_t > const &sortedB)
 
bool mergeChains (std::vector< ExpansionChain > &toExpand)
 
void fillDigits (const vector< short > &digits, vector< short > &receiver)
 
ostream & operator<< (ostream &fout, const PropertyList &props)
 
void suppressTerm (Expr &init, Expr const &term)
 
void MakeScalarIntegral (Expr &init)
 
void convertScalarFuncType (const Abstract *expr, csl::Type &type)
 
bool valueRule (const Abstract *A, const Abstract *B)
 
bool complexRule (const Abstract *A, const Abstract *B)
 
bool evalRule (const Abstract *A, const Abstract *B)
 
bool alphaRule (const Abstract *A, const Abstract *B)
 
bool mathRule (const Abstract *A, const Abstract *B)
 
bool sumRule (const Abstract *A, const Abstract *sum)
 
bool prodRule (const Abstract *A, const Abstract *prod)
 
bool powRule (const Abstract *A, const Abstract *pow)
 
bool sumRule_inverted (const Abstract *A, const Abstract *sum)
 
bool prodRule_inverted (const Abstract *A, const Abstract *prod)
 
bool powRule_inverted (const Abstract *A, const Abstract *pow)
 
bool vectorialRule (const Abstract *A, const Abstract *B)
 
bool ruleO1 (const Abstract *A, const Abstract *B)
 
bool compareDuoArgs (const Expr &argA0, const Expr &argA1, const Expr &argB0, const Expr &argB1)
 
bool ruleO2 (const Abstract *A, const Abstract *B)
 
bool ruleO2_inverted (const Abstract *A, const Abstract *B)
 
bool ruleO3 (const Abstract *A, const Abstract *B)
 
bool ruleO4 (const Abstract *A, const Abstract *B)
 
bool ruleO5 (const Abstract *A, const Abstract *B)
 
bool ruleO6 (const Abstract *A, const Abstract *B)
 
bool ruleO7 (const Abstract *A, const Abstract *B)
 
void selectionSort (iterator first, iterator last)
 
void sort (iterator first, iterator last)
 
void mergeSort (iterator first, iterator last)
 
int compare (string_view a, string_view b)
 
bool operator> (const string &a, const string &b)
 
bool operator< (const string &a, const string &b)
 
bool operator>= (const string &a, const string &b)
 
bool operator<= (const string &a, const string &b)
 
std::ostream & operator<< (std::ostream &fout, const Permutation &permutation)
 
vector< vector< int > > permutations (vector< int > init)
 
std::ostream & operator<< (std::ostream &fout, const Symmetry &symmetry)
 
ostream & operator<< (ostream &fout, const IndexedSymmetry &sym)
 
vector< list< int > > getNonZeroElements_impl (Expr_info vec)
 
vector< vector< int > > getNonZeroElements (Expr_info vec)
 
int sort_keep_sign (typename std::vector< int >::iterator begin, typename std::vector< int >::iterator end)
 
Expr matrix_s (const initializer_list< initializer_list< Expr > > &t_matrix)
 
Expr highdtensor_s (const vector< int > &shape)
 
Expr highdtensor_s (const vector< int > &shape, const Expr &filler)
 
Expr highdtensor_from_args_s (const csl::vector_expr &t_argument)
 
Expr highdtensor_s (const initializer_list< initializer_list< initializer_list< Expr > > > &t_tensor)
 

Variables

std::map< std::string, std::vector< AbstractParent * > > abbreviationData
 
csl::allocator< TensorElementalloc_itensor
 
csl::allocator< ISumalloc_isum
 
csl::allocator< IProdalloc_iprod
 
csl::allocator< Constantalloc_constant
 
csl::allocator< Variablealloc_variable
 
csl::allocator< Integeralloc_integer
 
csl::allocator< Floatalloc_float
 
csl::allocator< IntFractionalloc_intfraction
 
csl::allocator< Complexalloc_complex
 
csl::allocator< Sumalloc_sum
 
csl::allocator< Prodalloc_prod
 
csl::allocator< Powalloc_pow
 
const int maxMantisseSize = 64
 
size_t PRECISION = 100
 
bool WARN_OVERFLOW = false
 
template<class T , class U , class Type , class Type2 = Type>
constexpr bool canDecay_v = canDecay<T, U, Type, Type2>::value
 
bool RANDOM_SEED = false
 
const int NUMBER_OF_MUTATIONS = 7
 
const int NATURAL_SELECTION = 3
 
const int NUMBER_OF_GENERATION = 11
 
const int GENERATION_BEFORE_SELECTION = 5
 
const int SIMPLIFICATION_METHOD = 1
 Determines which simplification method is applied. Ther used to be 2, now there is only one method. It may be useful in the future.
 
const int MAX_ALTERNATE_FORMS = 10
 Maximum number of alternate forms given by getRecursiveAlternateForms(). When getting alternate forms of an expression, we keep only the MAX_ALTERNATE_FORMS simpler.
 
const int MAX_RECURSION_ALTERNATE = 7
 When getting alternateForms, we iterate MAX_RECURSION_ALTERNATE times (getting alternate forms of the alternate forms) in order to allow alternates that need several steps of Transformation.
 
size_t minMergeSize = 10
 Minimum size for a container to be sorted with mergeSort(). More...
 
Expr DMinko = csl::constant_s("D", csl::int_s(4))
 
const SpaceMinkowski = buildMinkowski()
 Space $ R^{1,3} $ with a metric g = diag(-1,1,1,1).
 
Vector_alloc alloc_expr
 

Detailed Description

Namespace for csl library.

Typedef Documentation

◆ replacementRule

using csl::replacementRule = typedef std::function<std::optional<csl::Expr>(csl::Expr const&, bool)>

Replacement rule prototype.

The function takes a constant expression as parameter and a boolean. If true, this boolean specifies that the rule is used only as a predicate for the moment i.e. that no calculation must be done in the return value (the optional will be used as a bool to know if a replacement must take place). If false, this function must return the result of the replacement in the std::optional<csl::Expr>. If no replacement is possible, return std::nullopt.

Enumeration Type Documentation

◆ ComplexProperty

enum csl::ComplexProperty
strong

Contains all possible complex properties of objects. Real, purely imaginary, or complex.

Enumerator
Complex 

complex object, $ z^* \neq z. $

Real 

real object, $ z^* = z. $

Imaginary 

imaginary object, $ z^* = -z. $

◆ PrimaryType

enum csl::PrimaryType
strong

Stores enumerations of types for Abstract objects.

Enumerator
Numerical 

= 0. Concerns Number and IntFraction.

Literal 

= 1. Concerns Variable, IntFactorial and Imaginary.

MultiFunction 

= 10. Concerns all scalar multi-variate functions (Sum, Prod, Pow, etc).

ScalarFunction 

= 20. Concerns all scalar uni-variate functions (Exp, Log, Cos, etc).

Vectorial 

= 50. Concerns Vector, Matrix and HighDTensor.

Indicial 

= 60. Concerns all indicial exprs.

Field 

= 70. Concerns all Fields exprs.

◆ Type

enum csl::Type
strong

Enum of the different types of Abstract (i.e. list of all possible specializations).

Type of Index.

Enumerator
NoType 

Arbitrary Abstract in comparisons

Integer 

Abstract specialized in Integer

Float 

Abstract specialized in Float

IntFraction 

Abstract specialized in IntFraction

IntFactorial 

Abstract specialized in IntFactorial

Complex 
  1. Abstract specialized in Complex
NumericalEval 

Abstract specialized in NumericalEval

Imaginary 

Abstract specialized in Imaginary

Constant 

Abstract specialized in Constant

Variable 

Abstract specialized in Variable

Exp 

Abstract specialized in Exp

Log 

Abstract specialized in Log

DiracDelta 

Abstract specialized in Dirac Delta

Abs 

Abstract specialized in Abs

Cos 

Abstract specialized in Cos

Sin 

Abstract specialized in Sin

Tan 

Abstract specialized in Tan

Cosh 

Abstract specialized in Cosh

Sinh 

Abstract specialized in Sinh

Tanh 

Abstract specialized in Tanh

ACos 

Abstract specialized in ACos

ASin 

Abstract specialized in ASin

ATan 

Abstract specialized in ATan

ACosh 

Abstract specialized in ACosh

ASinh 

Abstract specialized in ASinh

ATanh 

Abstract specialized in ATanh

Scalar 

Abstract specialized in Scalar.

RealPart 

Abstract specialized in real part.

ImaginaryPart 

Abstract specialized in imaginary part.

TensorElement 

Abstract specialized in TensorElement

ScalarField 

Abstract specialized in ScalarField.

TensorFieldElement 

Abstract specialized in TensorFieldElement.

StandardDuo 

Abstract specialized in StandardDuo

StandardMult 

Abstract specialized in StandardDuo

Pow 

Abstract specialized in Pow

Prod 

Abstract specialized in Prod

Sum 

Abstract specialized in Sum

Polynomial 

Abstract specialized in Polynomial

Derivative 

Abstract specialized in Derivative

Commutator 

Abstract specialized in Commutator

Angle 

Abstract specialized in Angle

Factorial 

Abstract specialized in Factorial

Integral 

Abstract specialized in Integral

ScalarIntegral 

Abstract specialized in ScalarIntegral.

VectorIntegral 

Abstract specialized in VectorIntegral.

Vector 

Abstract specialized in Vector

Matrix 

Abstract specialized in Matrix

HighDTensor 

Abstract specialized in HighDTensor

Function Documentation

◆ abs_s()

Expr csl::abs_s ( const Expr expr)

Creates an object of type Abs acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an abs funtion. Then the return value is not an Abs object but something else, so we must implement a function that will create the good object. For example abs(1) returns 1 (a Number) and not abs(1) (an Abs).

Parameters
exprArgment of the abs funtion function.
Returns
Abs applied on expr

◆ acos_s()

Expr csl::acos_s ( const Expr expr)

Creates an object of type ACos acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an acosonential. Then the return value is not an ACos object but something else, so we must implement a function that will create the good object. For example acos(0) returns pi/2 (a Number) and not acos(0) (a ACos).

Parameters
exprArgment of the acos function.
Returns
ACos applied on expr

◆ acosh_s()

Expr csl::acosh_s ( const Expr expr)

Creates an object of type ACosh acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an acoshonential. Then the return value is not an ACosh object but something else, so we must implement a function that will create the good object. For example acosh(0) returns 1 (a Number) and not acosh(0) (a ACosh).

Parameters
exprArgment of the acosh function.
Returns
ACosh applied on expr

◆ addAlternateForm()

void csl::addAlternateForm ( csl::vector_expr &  alternateForms,
const Expr newAlternate,
bool  add_factor_expand = true 
)

Tried to add newAlternate in the set alternateForms. We simply test if the alternate is already present in the set newAlternate and add it if it is not the case. If add_factor_expand is set to true, we try to add the expanded and the factored forms of newAlternate.

Parameters
alternateFormsstd::vector of expressions in which we add newAlternate.
newAlternateExpression to add.
add_factor_expandBoolean determining if we want to add also the factored and expanded versions of newAlternate.

◆ AllOfLeafs()

bool csl::AllOfLeafs ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
int  depth = -1 
)

Tells if all of the leafs of an expression respect a certain condition given by the user.

If one of the leafs of init respects the condition f given by the user the function returns true. Else it returns false.

Parameters
initExpression in which the function searches recursively.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning a boolean.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
True if all of the leafs of init respects the condition f.
False else.
See also
AllOfLeafs(), AnyOfNodes(), AllOfNodes().

◆ AllOfNodes()

bool csl::AllOfNodes ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
int  depth = -1 
)

Tells if all of the nodes of an expression respect a certain condition given by the user.

If one of the nodes of init respects the condition f given by the user the function returns true. Else it returns false.

Parameters
initExpression in which the function searches recursively.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning a boolean.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
True if all of the nodes of init respects the condition f.
False else.
See also
AllOfLeafs(), AnyOfNodes(), AllOfNodes().

◆ AnyOfLeafs()

bool csl::AnyOfLeafs ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
int  depth = -1 
)

Tells if any of the leafs of an expression respect a certain condition given by the user.

If one of the leafs of init respects the condition f given by the user the function returns true. Else it returns false.

Parameters
initExpression in which the function searches recursively.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning a boolean.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
True if any of the leafs of init respects the condition f.
False else.
See also
AllOfLeafs(), AnyOfNodes(), AllOfNodes().

◆ AnyOfNodes()

bool csl::AnyOfNodes ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
int  depth = -1 
)

Tells if any of the nodes of an expression respect a certain condition given by the user.

If one of the nodes of init respects the condition f given by the user the function returns true. Else it returns false.

Parameters
initExpression in which the function searches recursively.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning a boolean.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
True if any of the nodes of init respects the condition f.
False else.
See also
AllOfLeafs(), AnyOfLeafs(), AllOfNodes().

◆ ApplyChainProperty()

void csl::ApplyChainProperty ( Expr init,
csl::Tensor tensor,
std::vector< Expr > const &  prod,
Expr const &  res 
)

Declares a chain contraction property just the time of a refresh in order to apply it on one expression.

Parameters
initExpression on which we apply the property.
tensorIndicial tensor that has the property.
prodTensors in the contraction.
resResult of the contraction.
See also
ApplyChainProperty(), AddSelfContraction() , TensorParent::addSelfContraction().

◆ ApplySelfProperty()

void csl::ApplySelfProperty ( Expr init,
csl::Tensor tensor,
Expr const &  A,
Expr const &  B,
Expr const &  res 
)

Declares a self contraction property just the time of a refresh in order to apply it on one expression.

Parameters
initExpression on which we apply the property.
tensorIndicial tensor that has the property.
AFirst tensor in the contraction.
BSecond tensor in the contraction.
resResult of the contraction.
See also
ApplyChainProperty(), AddSelfContraction() , TensorParent::addSelfContraction().

◆ applyThroughAbbreviations()

void csl::applyThroughAbbreviations ( csl::Expr expr,
replacementRule const &  rule 
)

Applies a replacement rule thoughout an expression, also entering abbreviations and replacing them if a replacement is found.

Parameters
exprExpression in which the replacement takes place.
ruleRule for the replacement.

◆ asin_s()

Expr csl::asin_s ( const Expr expr)

Creates an object of type ASin acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an asin. Then the return value is not an ASin object but something else, so we must implement a function that will create the good object. For example asin(0) returns 0 (a Number) and not asin(0) (an ASin).

Parameters
exprArgment of the asin function.
Returns
ASin applied on expr

◆ asinh_s()

Expr csl::asinh_s ( const Expr expr)

Creates an object of type ASinh acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an asinh. Then the return value is not an ASinh object but something else, so we must implement a function that will create the good object. For example asinh(0) returns 0 (a Number) and not asinh(0) (an ASinh).

Parameters
exprArgment of the asinh function.
Returns
ASinh applied on expr

◆ atan_s()

Expr csl::atan_s ( const Expr expr)

Creates an object of type ATan acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an atan. Then the return value is not an ATan object but something else, so we must implement a function that will create the good object. For example atan(0) returns 0 (a Number) and not atan(0) (a ATan).

Parameters
exprArgment of the atan function.
Returns
ATan applied on expr

◆ atanh_s()

Expr csl::atanh_s ( const Expr expr)

Creates an object of type ATanh acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an atanh. Then the return value is not an ATanh object but something else, so we must implement a function that will create the good object. For example atanh(0) returns 0 (a Number) and not atanh(0) (a ATanh).

Parameters
exprArgment of the atanh function.
Returns
ATanh applied on expr

◆ callError()

template<typename T >
csl::callError ( cslError::Error  error,
const std::string &  caller,
spec 
)
inline

Displays an error message depending on the error error, the name of the caller function caller and a possible specificity of the error spec. For example spec is the index for OutOfBound error. This function stops the program.

Parameters
errorThe type of error.
callerThe caller function.
specA printable specificity of the error.

◆ callWarning()

template<typename T >
csl::callWarning ( cslError::Warning  warning,
const std::string &  caller,
spec 
)
inline

Displays a warning message depending on the warning warning, the name of the caller function caller and a possible specificity of the warning spec. For example spec is the dimension for InvalidDimension error. This function does not stop the program.

Parameters
warningThe type of warning.
callerThe caller function.
specA printable specificity of the warning.

◆ CheckValidity()

bool csl::CheckValidity ( Expr const &  init,
std::vector< Expr_info encountered = std::vector<Expr_info>() 
)

Checks the validity of an expression.

Browses the whole expression and checks that every node of the tree is valid (!= nullptr).

Parameters
initExpression to check.
encounteredList of expressions already checked. Should not be given by the user in general.
Returns
True if the expression is valid.
False else.

◆ clearRedundancyAlternate()

void csl::clearRedundancyAlternate ( csl::vector_expr &  alternateForms)

Search and remove redundancies (equal alternate forms) in alternateForms.

Parameters
alternateFormsstd::vector of expressions to reduce.

◆ Commutation()

Expr csl::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, and returns CSL_UNDEF else. Useful to test if two objects commute.

Parameters
ALeft hand side.
BRight hand side.
signSign of the commutator, -1 for commutation (default), 1 for anti-commutation.
Returns
CSL_0 if A and B commute.
CSL_UNDEF else.

◆ commutator_()

Expr csl::commutator_ ( const Expr A,
const Expr B,
int  t_sign = -1 
)

Tries to create a Commutator object of A and B of sign sign.

If the result is CSL_0, this function returns CSL_0. If A and/or B are products, the functions expands the give at the end a more complicated expression but with just (anti-)commutators of single elements, expressions of type [{E,F}] with E and F neither sums nor products.

Parameters
ALeft hand side of the Commutator.
BRight hand side of the Commutator.
t_signSign of the Commutator.
Returns
[A,B] (or {A,B}) if the result is not defined (in particular not CSL_0).
The result of [A,B] (or {A,B}) if there is special things to do.

◆ comparePlaceIndependant()

template<typename T >
bool csl::comparePlaceIndependant ( std::vector< T >  A,
std::vector< T >  B 
)

Template function that compares the elements in two vectors A and B, independently on their order.

Template Parameters
TType of data, must have a well-defined operator==.
Parameters
ALeft hand side.
BRight hand side.
Returns
True if all elements in A (no more no less) are present in , independently on their order.

◆ Copy() [1/2]

Expr csl::Copy ( const Abstract expr)

See Copy(const Expr& expr).

Note
With the apparition of shared_from_this(), this function should be removed soon.

◆ Copy() [2/2]

Expr csl::Copy ( const Expr expr)

Copy an Abstract to depth 1.

Copy the depth 0 structure. For example the copy of cos(x+exp(y)) creates another cos function but take a reference to x+exp(y). Note that copy a Variable will create another with the same name. It could create misunderstanding in the following operations.

Parameters
exprAbstract to copy.
Returns
The copy.

◆ cos_s()

Expr csl::cos_s ( const Expr expr)

Creates an object of type Cos acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an cosonential. Then the return value is not an Cos object but something else, so we must implement a function that will create the good object. For example cos(0) returns 1 (a Number) and not cos(0) (a Cos).

Parameters
exprArgment of the cos function.
Returns
Cos applied on expr

◆ cosh_s()

Expr csl::cosh_s ( const Expr expr)

Creates an object of type Cosh acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an coshonential. Then the return value is not an Cosh object but something else, so we must implement a function that will create the good object. For example cosh(0) returns 1 (a Number) and not cosh(0) (a Cosh).

Parameters
exprArgment of the cosh function.
Returns
Cosh applied on expr

◆ DeepCopy() [1/2]

Expr csl::DeepCopy ( const Abstract expr)

See DeepCopy(const Expr& expr).

Note
With the apparition of shared_from_this(), this function should be removed soon.

◆ DeepCopy() [2/2]

Expr csl::DeepCopy ( const Expr expr)

Copy an Abstract to the maximum depth.

Copy recursively the entire Abstract.

Parameters
exprThe Abstract to copy.
Returns
The deepCopy.

◆ DeepRefreshed()

Expr csl::DeepRefreshed ( const Expr expr)

Refreshed recursively an Abstract and apply basic simplifications.

Apply all simplifications that take place normally at the creation of an Abstract. For example, a sum with only one term gives just the term in question. The refresh is resursive.

Parameters
exprThe Abstract to refresh.
Returns
The refreshed Abstract.

◆ derivative_s()

Expr csl::derivative_s ( const Expr leftOperand,
const Expr rightOperand,
int  order = 1 
)

Returns the derivative of leftOperand wrt rightOperand, applying basic simplifications.

This function possibly returns an object different from a Derivative object if the simplification requires so.

Parameters
leftOperandLeft operand.
rightOperandRight operand.
orderOrder of derivation.
Returns
The derivative of leftOperand wrt rightOperand at the order order.

◆ dichotomyFindIf()

template<class Iterator , class Comparator >
Iterator csl::dichotomyFindIf ( Iterator  first,
Iterator  last,
Comparator &&  f 
)

Template dichotomy algorithm using a comparator.

For the insertion of an element e, the comparator given must take one argument (of the same type as the range's elements) and return +1 if the element to insert is simpler than the argument, -1 if it is less simple, and 0 otherwise.

Template Parameters
IteratorIterator type.
ComparatorComparator type.
Parameters
firstFirst iterator in the range.
lastLast iterator in the range.
fComparator function.
Returns
The iterator where the element compared with $$f$$ must be inserted.

◆ exp_s()

Expr csl::exp_s ( const Expr expr)

Creates an object of type Exp acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an exponential. Then the return value is not an Exp object but something else, so we must implement a function that will create the good object. For example exp(0) returns 1 (a Number) and not exp(0) (an Exp).

Parameters
exprArgment of the exponential function.
Returns
Exp applied on expr

◆ factorial()

double csl::factorial ( int  n)

Returns the factorial of a.

Parameters
a
Returns
a!
Bug:
The factorial function returns a double for now and so is quickly out of bounds for exact numerical precision. The limit is between 20! and 25!.

◆ FindIfLeaf()

Expr csl::FindIfLeaf ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
size_t  depth = -1 
)

Searches and returns an expression in another.

If one of the leafs of init compares to value successfully using the condition f given by the user the function returns it. Else it returns nullptr. Beware that in this case the result is invalid.

Parameters
initExpression in which the function searches.
fstd::function (can be a c++ lambda expression) taking an Expr as parameter and returning a boolean.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
The first leaf to respect the condition if found.
nullptr else.
See also
FindNode(), FindLeaf(), FindIfNode().

◆ FindIfNode()

Expr csl::FindIfNode ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
size_t  depth = -1 
)

Searches and returns an expression in another.

If one of the nodes of init compares to value successfully using the condition f given by the user the function returns it. Else it returns nullptr. Beware that in this case the result is invalid.

Parameters
initExpression in which the function searches.
fstd::function (can be a c++ lambda expression) taking an Expr as parameter and returning a boolean.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
The first node to respect the condition if found.
nullptr else.
See also
FindNode(), FindLeaf(), FindIfLeaf().

◆ FindLeaf()

Expr csl::FindLeaf ( Expr const &  init,
Expr const &  value,
size_t  depth = -1 
)

Searches and returns an expression in another.

If one of the leafs of init compares to value successfully the function returns it. Else it returns nullptr. Beware that in this case the result is invalid.

Parameters
initExpression in which the function searches.
valueSub-expression to find.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
The first leaf to compare to value if found.
nullptr else.
See also
FindNode(), FindIfLeaf(), FindIfNode().

◆ FindNode()

Expr csl::FindNode ( Expr const &  init,
Expr const &  node,
size_t  depth = -1 
)

Searches and returns an expression in another.

If one of the nodes of init compares to value successfully the function returns it. Else it returns nullptr. Beware that in this case the result is invalid.

Parameters
initExpression in which the function searches.
valueSub-expression to find.
depthDepth of recursion in the search (default = -1, full recursion).
Returns
The first node to compare to value if found.
nullptr else.
See also
FindLeaf(), FindIfNode(), FindIfLeaf().

◆ FirstOfLeaf()

bool csl::FirstOfLeaf ( Expr init,
std::function< bool(Expr &)> const &  f 
)

Tells if any of the leafs of an expression respect a certain condition given by the user. The condition function may apply on the go on the expression found.

If one of the leafs of init respects the condition f given by the user the function returns true. Else it returns false. Once one node has been found, the function stops completely.

Parameters
initExpression in which the function searches recursively.
fstd::function (can be a c++ lambda expression) taking an Expr& as parameter and returning a boolean. May modify the content of the expression.
Returns
True if any of the leafs of init respects the condition f.
False else.
See also
FirstOfLeaf().

◆ FirstOfNode()

bool csl::FirstOfNode ( Expr init,
std::function< bool(Expr &)> const &  f 
)

Tells if any of the nodes of an expression respect a certain condition given by the user. The condition function may apply on the go on the expression found.

If one of the nodes of init respects the condition f given by the user the function returns true. Else it returns false. Once one node has been found, the function stops completely.

Parameters
initExpression in which the function searches recursively.
fstd::function (can be a c++ lambda expression) taking an Expr& as parameter and returning a boolean. May modify the content of the expression.
Returns
True if any of the nodes of init respects the condition f.
False else.
See also
FirstOfLeaf().

◆ ForEachLeaf()

void csl::ForEachLeaf ( Expr init,
std::function< void(Expr &)> const &  f,
int  depth = -1 
)

Applies a user function on each leaf of an expression. The expression may be modified.

This algorithm browses the whole expression applying f to each leaf. If the user function f does not modify the leafs, consider using VisitEachLeaf() instead.

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr& (may or may not modify it) as parameter.
depthDepth of recursion in the search (default = -1, full recursion).
See also
ForEachNode(), ForEachNodeCut(), Transform().

◆ ForEachNode()

void csl::ForEachNode ( Expr init,
std::function< void(Expr &)> const &  f,
int  depth = -1 
)

Applies a user function on each node of an expression. The expression may be modified.

This algorithm browses the whole expression applying f to each node. If the user function f does not modify the nodes, consider using VisitEachNode() instead.

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr& (may or may not modify it) as parameter.
depthDepth of recursion in the search (default = -1, full recursion).
See also
ForEachLeaf(), ForEachNodeCut(), Transform().

◆ ForEachNodeCut()

void csl::ForEachNodeCut ( Expr init,
std::function< bool(Expr &)> const &  f,
int  depth = -1 
)

Applies a user function on each node of an expression. The expression may be modified.

This algorithm browses the whole expression applying f to each node. If the user function f does not modify the nodes, consider using VisitEachNodeCut() instead. The user function must return a boolean. If true, the algorithm stops on the node (other branches are still explored).

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr& (may or may not modify it) as parameter. Must return a boolean that tells if the algorithm must stop to search in that branch, if that boolean is true.
depthDepth of recursion in the search (default = -1, full recursion).
See also
ForEachLeaf(), ForEachNode(), VisitEachNodeCut().

◆ fraction_s()

Expr csl::fraction_s ( const Expr leftOperand,
const Expr rightOperand 
)

Returns the fraction of the two operands, applying basic simplifications.

This function possibly returns an object different from a Fraction object if the simplification requires so. For example 1/(x^(-1)) -> x that is a Variable.

Parameters
leftOperandLeft operand.
rightOperandRight operand.
Returns
The fraction of leftOperand and rightOperand.

◆ generateTensor()

Expr csl::generateTensor ( const std::string &  name,
const std::vector< const Space *> &  spaces 
)

Generates a tensor of name name that lives in a list of spaces, filled with variables given by nameTensor().

Parameters
nameName of the tensor.
spacesList of spaces in which the tensor lives (just to get the dimensions).
Returns
An Expr that is the generated tensor.

◆ getRecursiveAlternateForms()

csl::vector_expr csl::getRecursiveAlternateForms ( const Expr expr,
int  depth = -1 
)

Returns the alternate forms of expr by applying recursively internalRecursiveAlternateForms() MAX_RECURSION_ALTERNATE times: take alternates, then alternates of the alternates etc.

Parameters
exprExpression from which we search alternates.
depthRecursion depth transmitted to internalRecursiveAlternateForms().
Returns
a std::vector of expressions containing alternates of expr.

◆ getSpan() [1/2]

std::vector< Permutation > csl::getSpan ( const std::vector< Permutation > &  init)

Calculates all permutations spanned by an ensemble of initial Permutations init.

Parameters
initInitial permutations in a std::vector of Permutation.
Returns
All permutations spanned by the initial vector Init in the form of a another vector of Permutation objects.

◆ getSpan() [2/2]

void csl::getSpan ( std::vector< Permutation > &  spanned,
const Permutation element 
)

This function adds an element in an already complete set of permutations. It assumes that the std::vector spanned is already complete by itself and modifies it by adding all the permutations spanned by itself and the new permutation element.

Parameters
spannedInitial set of Permutation objects, must be already complete. It is modified during the call of the function.
elementPermutation to add.

◆ hasWeakDependency()

bool csl::hasWeakDependency ( csl::Expr const &  expr,
std::function< bool(csl::Expr const &)> const &  predicate 
)

Search for a true value for a given predicate in an expression, considering also sub-expressions encapsulated by abbreviations.

Parameters
exprThe expression in which the search is done.
predicateBoolean predicate.
Returns
True if on sub-expression checks the predicate.
False else.

◆ internal_factorial()

long long int csl::internal_factorial ( long long int  n)

Returns the factorial of a.

Parameters
a
Returns
a!

◆ internal_PGCD()

int csl::internal_PGCD ( long long int  a,
long long int  b 
)

Returns the PGCD of a and b.

This function is called only by PGCD(int a, int b) that do the nexessary checks on a and b before the calculation. Then the algorithm implemented in internal_PGCD() is Euclid's (recursive). The separation of the cjeck function PGCD() and the calculation function internal_PGCD() allows to check only once a and b since the algorithm is recursive.

Parameters
a
b
Returns
PGCD(a,b)

◆ internalRecursiveAlternateForms()

csl::vector_expr csl::internalRecursiveAlternateForms ( const Expr expr,
int  depth = -1 
)

Calculates and return all alternate forms of expr, by getting (once) alternate forms of the possible arguments of expr, and then the specific alternates of expr.

Parameters
exprExpression from which we get alternate forms.
depthRecursion depth (default = -1, we take the alternate forms of all the recursion tree).
Returns
A std::vector of expressions containing the alternate forms of expr.

◆ intfactorial_s()

Expr csl::intfactorial_s ( int  value)
Parameters
valueInitializer of the IntFactorial.
Returns
IntFactorial(value) if value > 2
Number(value) else
Note
This function can be used to return a Symbol. The Symbol constructor Symbol::Symbol(const Expr&) is implemented and allows to put the return value of this function in a Symbol.

◆ log_s()

Expr csl::log_s ( const Expr expr)

Creates an object of type Log acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an logarithm. Then the return value is not an Log object but something else, so we must implement a function that will create the good object. For example log(1) returns 0 (a Number) and not log(1) (a Log).

Parameters
exprArgment of the logarithm function.
Returns
Log applied on expr

◆ MemorySizeOf()

size_t csl::MemorySizeOf ( Expr const &  expression)

Calculates an estimate of the total memory that an expression takes.

This function is not exact. It should be extended. The problem is that it is not possible for class with pointers to determine automatically the size of all elements and pointed elements. It has to be hard coded. This function ignores all pointed elements that are not accessible by the Abstract::getArgument() function.

Parameters
expressionExpression from which we measure the size.
Returns
The total (recursive) size in bytes of the expression tree, ignoring all non-Expr pointed elements.

◆ mergeSort() [1/2]

void csl::mergeSort ( std::vector< Expr > &  argument)

Applies the merge sort algorithm $ \mathcal{O}(N\log N) $ on a container.

This function is recursive, calling a merge sort on parts of the container. Once the size of these parts are bellow minMergeSize, selectionSort() is called instead. For std::shared_ptr (the case for the Expr type) the optimal size is around 10. This means that with less than 10 elements, selectionSort() is still faster that mergeSort(). Above, the $ \mathcal{O}(N\log N) $ complexity of mergeSort() is of course better and better with large $ N $.

Parameters
argumentContainer to sort.

◆ mergeSort() [2/2]

void csl::mergeSort ( std::vector< Expr >::iterator  first,
std::vector< Expr >::iterator  last 
)

Applies the merge sort algorithm $ \mathcal{O}(N\log N) $ on a container.

This function is recursive, calling a merge sort on parts of the container. Once the size of these parts are bellow minMergeSize, selectionSort() is called instead. For std::shared_ptr (the case for the Expr type) the optimal size is around 10. This means that with less than 10 elements, selectionSort() is still faster that mergeSort(). Above, the $ \mathcal{O}(N\log N) $ complexity of mergeSort() is of course better and better with large $ N $.

Parameters
firstIterator pointing to the first element (.begin()).
lastIterator pointing to the last element (.end()).

◆ minus_()

Expr csl::minus_ ( const Expr leftOperand,
const Expr rightOperand 
)

Returns the sum of the two operands (with a minus sign), applying basic simplifications.

This function possibly returns an object different from a Sum object if the simplification requires so. For example 0+x -> x that is a Variable. The Minus object does not exists, this function applies leftOperand + (-1*rightOperand).

Parameters
leftOperandLeft operand.
rightOperandRight operand.
Returns
The sum of leftOperand and rightOperand.

◆ nameTensor()

void csl::nameTensor ( const std::string &  name,
Expr tensor,
bool  first = true 
)

Fills an tensor with variables of the same name with the numbers correponding to their place in the tensor. Allows for example to name elements of a vector $ V $: $ \left( V_0,V_1,V_2,V_3\right)$.

The parameter first is due to the recursive nature of the function. It allows to know if the call of nameTensor() is the user's (first = true) or from another nameTensor()'s call (first = false). This parameter should then not be given by the user, but let to its default value true.

Parameters
nameName of the elements.
tensorTensor to fill (the Expr is modified in the function).
firstThis parameter should not be given by the user.

◆ operator!()

Index csl::operator! ( const Index index)

operator!, unary operator on Index that change the free property of the Index.

Parameters
indexIndex to copy.
Returns
A free Index similar to index if it is dummy.
A dummy Index similar to index if it is free.

◆ operator*()

Expr csl::operator* ( const Expr a,
const Expr b 
)

Shortcut function that allows to use arithmetic operator * with Expr (== shared_ptr<Abstract>).

Parameters
aconst Expr&.
bconst Expr&.
Returns
The expression result of a*b.

◆ operator+() [1/2]

Index csl::operator+ ( const Index index)

operator+, unary operator on Index that returns a similar Index with sign = 1 if the Space is signed, i.e. an Index up.

Parameters
indexThe Index to copy.
Returns
An index similar to index with a sign 1 i.e. a up Index.

◆ operator+() [2/2]

Expr csl::operator+ ( const Expr a,
const Expr b 
)

Shortcut function that allows to use arithmetic operator + with Expr (== shared_ptr<Abstract>).

Parameters
aconst Expr& .
bconst Expr&.
Returns
The expression result of a+b.

◆ operator-() [1/2]

Index csl::operator- ( const Index index)

operator-, unary operator on Index that returns a similar Index with sign = 0 if the Space is signed, i.e. an Index down.

Parameters
indexThe Index to copy.
Returns
An index similar to index with a sign 0 i.e. a down Index.

◆ operator-() [2/2]

Expr csl::operator- ( const Expr a,
const Expr b 
)

Shortcut function that allows to use arithmetic operator - with Expr (== shared_ptr<Abstract>).

Parameters
aconst Expr&.
bconst Expr&.
Returns
The expression result of a-b.

◆ operator/()

Expr csl::operator/ ( const Expr a,
const Expr b 
)

Shortcut function that allows to use arithmetic operator / with Expr (== shared_ptr<Abstract>).

Parameters
aconst Expr&.
bconst Expr&.
Returns
The expression result of a/b.

◆ operator<<() [1/6]

std::ostream& csl::operator<< ( std::ostream &  fout,
csl::Type  type 
)

Displays the name of a given csl::Type in order to be readable.

Parameters
foutOut stream in which the type is send.
typeType to display.
Returns
fout

◆ operator<<() [2/6]

std::ostream& csl::operator<< ( std::ostream &  fout,
csl::PrimaryType  primaryType 
)

Displays the name of a given csl::PrimaryType in order to be readable.

Parameters
foutOut stream in which the type is send.
typePrimaryType to display.
Returns
fout

◆ operator<<() [3/6]

std::ostream& csl::operator<< ( std::ostream &  fout,
const Permutation permutation 
)
Parameters
foutOutput flux.
permutationPermutation to diplay.
Returns
A reference to the modified flux fout.

◆ operator<<() [4/6]

std::ostream& csl::operator<< ( std::ostream &  fout,
const Symmetry symmetry 
)
Parameters
foutOutput flux.
permutationSymmetry to diplay.
Returns
A reference to the modified flux fout.

◆ operator<<() [5/6]

std::ostream& csl::operator<< ( std::ostream &  fout,
const AbstractParent parent 
)

std::ostream& operator<<(std::ostream& fout , const AbstractParent& p)

◆ operator<<() [6/6]

std::ostream& csl::operator<< ( std::ostream &  fout,
const TensorParent i 
)

std::ostream& operator<<(std::ostream& fout, const TensorParent& p)

◆ partialComparePlaceIndependant()

template<typename T >
bool csl::partialComparePlaceIndependant ( std::vector< T >  A,
std::vector< T >  B 
)

Template function that compares the elements in two vectors A and B, independently on their order, A can be bigger, this function determines if all elements in B are present in A.

Template Parameters
TType of data, must have a well-defined operator==.
Parameters
ALeft hand side.
BRight hand side.
Returns
True if all elements in B (and possibly more) are present in A independently on their order.

◆ permutations() [1/2]

std::vector<std::vector<int> > csl::permutations ( std::vector< int >  init)

Gets all permutations (int the form of vectors of integers) of n elements, n beeing the size of init. The vector init must contain all integers between 0 and n-1.

Parameters
initInitial set of n integers.
Returns
All the permutations of n elements in simple vectors of integers.

◆ permutations() [2/2]

vector< Permutation > csl::permutations ( const Permutation init)

Gets all permutations (int the form of Permutation objects) of n elements, n beeing the size of init.

Parameters
initInitial Permutation of n elements, can be identity.
Returns
All the permutations of n elements in Permutation objects.

◆ PGCD() [1/2]

int csl::PGCD ( double  a,
double  b 
)

Returns the PGCD of a and b.

If a and b are integers ( a == floor(a) and also for b) this function calls PGCD(int a, int b).

Parameters
a
b
Returns
PGCD(a,b) if a and b are integers.
1 else.

◆ PGCD() [2/2]

long long int csl::PGCD ( long long int  a,
long long int  b 
)

Returns the PGCD of a and b.

Proceeds to verifications on a and b (sign, non zero, etc) and calls internal_PGCD(int a, int b) if everythiong is Ok.

Parameters
a
b
Returns
PGCD(a,b)

◆ pow_s()

Expr csl::pow_s ( const Expr leftOperand,
const Expr rightOperand 
)

Returns the exponentiation of the two operands, applying basic simplifications.

This function possibly returns an object different from a Pow object if the simplification requires so. For example x^1 -> x that is a Variable.

Parameters
leftOperandLeft operand.
rightOperandRight operand.
Returns
The exponentiation of leftOperand and rightOperand.

◆ printVector()

void csl::printVector ( const csl::vector_expr &  vector)

Display a vector of expressions. Useful in debug.

Parameters
vectorstd::vector of expressions to display.

◆ prod_s()

Expr csl::prod_s ( const Expr leftOperand,
const Expr rightOperand,
bool  explicitProd = 0 
)

Returns the product of the two operands, applying basic simplifications.

This function possibly returns an object different from a Prod object if the simplification requires so. For example 1*x -> x that is a Variable.

Parameters
leftOperandLeft operand.
rightOperandRight operand.
explicitProdIf true Prod::mergeTerms() is not called and no simplification is done concerning the reordering/merging of terms.
Returns
The product of leftOperand and rightOperand.

◆ reduceAlternate()

void csl::reduceAlternate ( csl::vector_expr &  alternateForms)

Reduces the number of elements in alternateForms to MAX_ALTERNATE_FORMS.

Parameters
alternateFormsstd::vector of expressions to reduce.

◆ reducePermutation()

void csl::reducePermutation ( std::vector< Permutation > &  permutation)

Takes a vector of Permutation objects and erase the redundant ones, i.e. the permutations present several times in the vector.

Parameters
permutationstd::vector of Permutation to reduce (modified during the call of the function).

◆ Refreshed() [1/2]

Expr csl::Refreshed ( const Abstract expr)

See Refreshed(const Expr& expr).

Note
With the apparition of shared_from_this(), this function should be removed soon.

◆ Refreshed() [2/2]

Expr csl::Refreshed ( const Expr expr)

Refreshed an Abstract and apply basic simplifications.

Apply all simplifications that take place normally at the creation of an Abstract. For example, a sum with only one term gives just the term in question.

Parameters
exprThe Abstract to refresh.
Returns
The refreshed Abstract.

◆ ruleToPredicate()

auto csl::ruleToPredicate ( replacementRule const &  rule)
inline

Converts a replacementRule into a predicate.

Parameters
ruleThe replacement rule to convert.
Returns
A lambda expression that calls the rule with a the "predicate" specification (meaning that the rule should not calculate the result of the replacement) and simply returns the boolean value of the returned optional.

◆ selectionSort() [1/2]

void csl::selectionSort ( std::vector< Expr > &  argument)

Applies the selection sort algorithm $ \mathcal{O}(N^2) $ on a container.

Parameters
argumentContainer to sort.

◆ selectionSort() [2/2]

void csl::selectionSort ( std::vector< Expr >::iterator  first,
std::vector< Expr >::iterator  last 
)

Applies the selection sort algorithm $ \mathcal{O}(N^2) $ on a container.

Parameters
firstIterator pointing to the first element (.begin()).
lastIterator pointing to the last element (.end()).

◆ sgn() [1/2]

long long int csl::sgn ( long long int  a)

Returns the sign of a.

Parameters
a
Returns
sign(a)

◆ sgn() [2/2]

int csl::sgn ( double  a)

Returns the sign of a.

Parameters
a
Returns
sign(a)

◆ Simplify()

Expr csl::Simplify ( const Expr expr,
int  depth = -1 
)

Simplifies expr depending on its type.

Parameters
exprExpression to reduce.
depthDepth of simplification. Default=1: max depth.
Returns
The simplified expression.

◆ sin_s()

Expr csl::sin_s ( const Expr expr)

Creates an object of type Sin acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an sin. Then the return value is not an Sin object but something else, so we must implement a function that will create the good object. For example sin(0) returns 0 (a Number) and not sin(0) (an Sin).

Parameters
exprArgment of the sin function.
Returns
Sin applied on expr

◆ sinh_s()

Expr csl::sinh_s ( const Expr expr)

Creates an object of type Sinh acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an sinh. Then the return value is not an Sinh object but something else, so we must implement a function that will create the good object. For example sinh(0) returns 0 (a Number) and not sinh(0) (an Sinh).

Parameters
exprArgment of the sinh function.
Returns
Sinh applied on expr

◆ sort() [1/2]

void csl::sort ( std::vector< Expr > &  argument)

Sorts a container using mergeSort().

Parameters
argumentContainer to sort.

◆ sort() [2/2]

void csl::sort ( std::vector< Expr >::iterator  first,
std::vector< Expr >::iterator  last 
)

Sorts a container using mergeSort().

Parameters
firstIterator pointing to the first element (.begin()).
lastIterator pointing to the last element (.end()).

◆ tan_s()

Expr csl::tan_s ( const Expr expr)

Creates an object of type Tan acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an tan. Then the return value is not an Tan object but something else, so we must implement a function that will create the good object. For example tan(0) returns 0 (a Number) and not tan(0) (a Tan).

Parameters
exprArgment of the tan function.
Returns
Tan applied on expr

◆ tanh_s()

Expr csl::tanh_s ( const Expr expr)

Creates an object of type Tanh acting on expr.

As all the outside-class functions, this one take into account the fact that the final object could not be an tanh. Then the return value is not an Tanh object but something else, so we must implement a function that will create the good object. For example tanh(0) returns 0 (a Number) and not tanh(0) (a Tanh).

Parameters
exprArgment of the tanh function.
Returns
Tanh applied on expr

◆ Transform()

bool csl::Transform ( Expr init,
std::function< bool(Expr &)> const &  f,
int  depth = -1 
)

Applies a user function on each node of an expression. The expression may be modified. If it is, the expression is refreshed.

This algorithm browses the whole expression applying f to each node. The user function must return true if the expression has to be refreshed after the transformation, false else. If you do not want to refresh the expression (powerful but heavy) consider using ForEachNode() instead.

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr& (may or may not modify it) as parameter. Must return a boolean, true if the expression requires a refresh after the call, false else.
depthDepth of recursion in the search (default = -1, full recursion).
See also
ForEachNode(), Refreshed(), DeepRefreshed().

◆ VisitEachLeaf()

void csl::VisitEachLeaf ( Expr const &  init,
std::function< void(Expr const &)> const &  f,
int  depth = -1 
)

Visits all leafs of an expression, applying a function on it without modifying it.

This algorithm browses all the leafs of init applying f each time.

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning nothing.
depthDepth of recursion in the search (default = -1, full recursion).
See also
VisitEachNode(), VisitEachNodeCut().

◆ VisitEachNode()

void csl::VisitEachNode ( Expr const &  init,
std::function< void(Expr const &)> const &  f,
int  depth = -1 
)

Visits all nodes of an expression, applying a function on it without modifying it.

This algorithm browses the whole expression applying f to each node.

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning nothing.
depthDepth of recursion in the search (default = -1, full recursion).
See also
VisitEachLeaf(), VisitEachNodeCut().

◆ VisitEachNodeCut()

void csl::VisitEachNodeCut ( Expr const &  init,
std::function< bool(Expr const &)> const &  f,
int  depth = -1 
)

Visits all nodes of an expression, applying a function on it without modifying it. When the user function returns true on one node, the underlying branch (if there is) is not explored.

This algorithm browses the whole expression applying f to each node. The user function must return a boolean. If true, the algorithm stops on the node (other branches are still explored).

Parameters
initExpression to browse.
fstd::function (can be a c++ lambda expression) taking an Expr const& as parameter and returning a boolean telling if the algorithm must stop on that branch.
depthDepth of recursion in the search (default = -1, full recursion).
See also
VisitEachLeaf(), VisitEachNode().

◆ WeakCommutation()

Expr csl::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, and returns CSL_UNDEF else. Useful to test if two objects commute. In the special of this function, A is an object that is not commutable (attribute Abstract::commutable) and B is commutable.

Parameters
ALeft hand side.
BRight hand side.
signSign of the commutator, -1 for commutation (default), 1 for anti-commutation.
Returns
CSL_0 if A and B commute.
CSL_UNDEF else.

Variable Documentation

◆ minMergeSize

size_t csl::minMergeSize = 10
inline

Minimum size for a container to be sorted with mergeSort().

For smaller containers, selectionSort() is called instead, even trying to use specifically mergeSort().