Documentation of CSL
Public Member Functions | Protected Attributes
csl::AbstractVectorial Class Reference
Inheritance diagram for csl::AbstractVectorial:
Inheritance graph
[legend]

Public Member Functions

std::string const & getName () const override
 Returns the Abstract's name. More...
 
void print (int mode=0, std::ostream &out=std::cout, bool lib=false) const override
 Displays the abstract in standard output. More...
 
void printCode (int mode=0, std::ostream &out=std::cout) const override
 
std::string printLaTeX (int mode=0) const override
 Creates a LaTeX output for the Abstract. More...
 
std::vector< ParentgetSubSymbols () const override
 
std::optional< Exprevaluate (csl::eval::mode user_mode=csl::eval::base) const override
 Evaluates the Abstract. More...
 
unique_Expr copy_unique () const override
 
Expr deepCopy () const override
 
Expr refresh () const override
 
Expr deepRefresh () const override
 
int getDim () const override
 Gives the dimension of the object. More...
 
csl::PrimaryType getPrimaryType () const override
 Gives the primary type of Abstract. More...
 
int getNArgs (int axis=0) const override
 Returns the number of arguments of the expression. If the expression is a building block (AbstractBuildingBlock), this function returns 0. More...
 
size_t size () const override
 
csl::vector_expr::iterator begin () override
 
csl::vector_expr::const_iterator begin () const override
 
csl::vector_expr::iterator end () override
 
csl::vector_expr::const_iterator end () const override
 
bool isReal () const override
 
bool isPurelyImaginary () const override
 
std::optional< ExprgetComplexConjugate () const override
 Calculates and returns the complex conjugate of the expression. More...
 
std::optional< ExprgetRealPart () const override
 Evaluates the real part of the Abstract and returns it. More...
 
Expr getImaginaryPart () const override
 Evaluates the imaginary part of the Abstract and returns it. More...
 
std::optional< ExprgetComplexModulus () const override
 Evaluates the modulus in the complex plane of the Abstract and returns it. More...
 
Expr const & getArgument (int iArg=0) const override
 
ExprgetArgument (int iArg=0) override
 
ExprgetArgument (const std::vector< int > &indices) override
 
Expr const & getArgument (const std::vector< int > &indices) const override
 Allows to get specific arguments of expressions in multiple dimensions, by giving the indices in each dimension. More...
 
bool dependsOn (Expr_info expr) const override
 Check recursively if the expression depends on expr. More...
 
bool dependsExplicitlyOn (Expr_info expr) const override
 Check recursively if expr is present in the expression. More...
 
bool dependsOn (Parent_info expr) const override
 
bool dependsExplicitlyOn (Parent_info expr) const override
 
bool commutesWith (Expr_info expr, int sign=-1) const override
 Tells if the object commutes with expr. More...
 
const csl::vector_expr & getVectorArgument () const override
 Allows to get the entire std::vector of arguments of the expression. More...
 
std::vector< int > getShape () const override
 Accessor to the shape of the tensor in the form of a std::vector of integers. More...
 
void setComplexProperty (csl::ComplexProperty t_prop) override
 
void setArgument (const Expr &expr, int iArg=0) override
 Sets the argument at position iArg (default=0). More...
 
void setArgument (const Expr &expr, const std::vector< int > &indices) override
 Sets the argument at position {i,j,...} for multi-dimensions expressions. More...
 
void setVectorArgument (const csl::vector_expr &t_argument) override
 Replaced the entire std::vector of argument. More...
 
bool matchShape (Expr_info expr, bool exact=false) const override
 In the case of a vectorial-type expression, this function checks if the shape of expr matches itself. More...
 
bool exactMatchShape (Expr_info expr) const
 
Expr getSum () const override
 Calculates and returns the sum of all elements in the Vectorial object. More...
 
Expr getProduct () const override
 Calculates and returns the product of all elements in the Vectorial object. More...
 
Expr getSubVectorial (const std::vector< int > &exceptions) const override
 Allows to pick a part of a Vectorial expression, excluding the iExcept^{th} element. More...
 
Expr getSubVectorial (const std::vector< std::vector< int >> &keepIndices) const override
 
Expr getSubVectorial (std::vector< std::vector< int >>::const_iterator begin, std::vector< std::vector< int >>::const_iterator end) const override
 
Expr getVectorialModulus () const override
 Returns the Vectorial modulus of the Vectorial object, that is defined here as the squared root of the sum of element squared. Example: {A_{11}^2+A_{12}^2+}. More...
 
Expr dot (const Expr &expr) const override
 Returns the dot product of two Vectorial expressions. More...
 
Expr addition_own (const Expr &expr) const override
 Contains implementation of special addition for Numerical- and Vectorial-types. More...
 
Expr multiplication_own (const Expr &expr, bool side=1) const override
 Contains implementation of special multiplication for Numerical- and Vectorial-types. More...
 
Expr tensordot (const Expr &expr) const override
 Returns the tensordot of two Vectorial expressions. More...
 
Expr trace (int axis1, int axis2) const override
 Calculates the trace over the axis axis1 and axis2 of a tensor. axis1 and axis2 can be the same, in which case the trace just corresponds to the sum over this particular axis. More...
 
Expr symmetrise () const override
 Calculates and returns the symmetrization of a 2D matrix. More...
 
Expr antisymmetrise () const override
 Calculates and returns the anti-symmetrization of a 2D matrix. More...
 
std::optional< Exprexpand (bool full=false, bool inplace=false) const override
 Develops the Abstract. More...
 
std::optional< Exprexpand_if (std::function< bool(Expr const &)> const &f, bool full=false, bool inplace=false) const override
 Develops the Abstract. More...
 
std::optional< Exprfactor (bool full=false) const override
 Factors the Abstract. More...
 
std::optional< Exprfactor (Expr_info expr, bool full=false) const override
 Factors the Abstract wrt a particular Abstract. More...
 
bool operator== (Expr_info expr) const override
 Compares the Abstract with another. More...
 
Exproperator[] (int iArg) override
 Access operator for multi-argument expressions, returns a reference so this function is not const. More...
 
Expr const & operator[] (int iArg) const override
 Access operator for multi-argument expressions, equivalent to the function getArgument(). More...
 
- Public Member Functions inherited from csl::Abstract
 Abstract ()
 Default Constructor. More...
 
virtual ~Abstract ()
 Destructor.
 
Expr self ()
 
virtual void printProp (std::ostream &fout=std::cout) const
 
void printExplicit (int mode=0) const
 Displays explicitely the expression, with types of each component. This function is only used for debug. More...
 
virtual LibDependency getLibDependency () const
 
virtual size_t memoryOverhead () const
 
virtual std::string const & getLatexName () const
 
virtual bool getCommutable () const
 Allows to know if the object commutes with all the others. More...
 
virtual bool getElementary () const
 
virtual bool getAllDependencies () const
 
virtual csl::Type getType () const =0
 Gives the type of Abstract. More...
 
virtual bool isBuildingBlock () const
 Tells if the expression is a Building Block or not. More...
 
virtual int getOrderOf (Expr_info expr) const
 
virtual bool isArbitrary () const
 
virtual bool isIndexed () const
 
virtual const std::vector< Equation * > & getProperties () const
 
virtual bool isComplexConjugate () const
 
virtual bool isHermitianConjugate () const
 
virtual csl::ComplexProperty getComplexProperty () const
 
virtual void setConjugated (bool t_conjugated)
 
virtual bool isInteger () const
 Tells if the expression is an integer. Either an Integer object directly, or a Float that has an integer value. More...
 
virtual bool getValued () const
 Tells if the expression is valued, i.e. is a function of numbers and valued literals (a Variable or Constant is not valued by default). More...
 
virtual long double getValue () const
 Returns the value of the expression, if it has one explicitely. In particular, it will work only on Numbers and valued Literals, not on functions. More...
 
virtual long double getDeltaPlus () const
 
virtual long double getDeltaMinus () const
 
virtual long long int getNum () const
 
virtual long long int getDenom () const
 
virtual bool empty () const
 
virtual Expr getVariable () const
 Accessor to the variable that defines certain types of expressions. More...
 
virtual int getOrder () const
 Accessor to the order (integer) that defines certain types of expressions. More...
 
virtual int getSign () const
 
virtual bool isAnOperator () const
 Tells if the expression is an operator (like a derivetive operator). More...
 
virtual bool isEmpty () const
 Tells for a Derivative or an Integral if the argument is empty i.e. if the object must apply on the next argument encountered on the right. More...
 
virtual bool operatorAppliesOn (Expr_info expr) const
 
virtual Expr getOperand () const
 Returns the operand of an Operator. More...
 
virtual Expr getInfBoundary () const
 
virtual Expr getSupBoundary () const
 
virtual void setSupBoundary (Expr const &t_inf)
 
virtual void setInfBoundary (Expr const &t_inf)
 
virtual int getNIndices () const
 
virtual Index getIndex (int i=0) const
 
virtual void resetIndexStructure ()
 
virtual IndexStructure getIndexStructure () const
 
IndexStructure getIndexStructure (csl::Space const *space) const
 
virtual const IndexStructuregetIndexStructureView () const
 
virtual IndexStructuregetIndexStructureView ()
 
virtual IndexStructure getFreeIndexStructure () const
 
virtual Parent getParent () const
 For indicial expressions this function returns a pointer to the parent object of type TensorParent (not an expression). More...
 
virtual Parent_info getParent_info () const
 
virtual Tensor getPoint () const
 
virtual int getNContractedPairs () const
 Returns the number of contracted pairs of indices in an Indicial expression. More...
 
virtual csl::vector_expr getPermutations (bool optimize=true) const
 Returns a std::vector of all possible permutations of an Indicial expression. The possible permutations are determined from the posible symmetries and anti-symmetries of the object. More...
 
virtual std::set< std::pair< int, int > > getContractedPair () const
 
Expr copy () const
 
virtual void setName (const std::string &t_name)
 Change the name of the abstract. More...
 
virtual void setCommutable (bool t_commutable)
 Allows the abstract to commute or not. More...
 
virtual void addProperty (Equation *property)
 Adds a property to the object. More...
 
virtual void removeProperty (Equation *property)
 Removes a property to the object. More...
 
virtual void setValue (long double t_value)
 Sets the value if there is one (for Numerical and Literal valued).
 
virtual void setValue (Expr const &t_value)
 
virtual void setElementary (bool t_elementary)
 
virtual void setAllDependencies (bool t_allDependencies)
 
virtual void addDependency (Expr const &expr)
 
virtual void removeDependency (Expr const &expr)
 
virtual void setEmpty (bool t_empty)
 
virtual void setOperand (const Expr &operand)
 Sets the operand of an operator. More...
 
virtual void setOperandPrivate (const Expr &operand, bool leaveEmpty)
 Sets the operand of an operator. More...
 
virtual void setVariable (Expr const &t_variable)
 
virtual void insert (const Expr &expr, bool side=1)
 Inserts an expression in a sum or a product. More...
 
virtual void setParent (const Parent &t_parent)
 
virtual std::optional< ExprreplaceIndex (const Index &indexToReplace, const Index &newIndex, bool refresh=true) const
 For indicial expressions, this function searches indexToContract and replaces it with newIndex. More...
 
virtual std::optional< ExprreplaceIndices (std::vector< Index > const &indexToReplace, std::vector< Index > const &newIndex, bool refresh=true, bool flipped=false) const
 
virtual void replaceIndexInPlace (Index const &oldIndex, Index const &newIndex)
 
std::optional< ExprcontractIndex (const Index &index) const
 
csl::vector_expr breakSpace (const Space *brokenSpace, const std::vector< const Space *> &newSpace) const
 
virtual csl::vector_expr breakSpace (const Space *brokenSpace, const std::vector< const Space *> &newSpace, const std::vector< std::string > &indexNames) const
 
virtual void setIndexStructure (const IndexStructure &t_index)
 Replaces the index structure of the object, that must be an Indicial expression. More...
 
virtual void setPoint (const Tensor &t_point)
 
virtual void setFullySymmetric ()
 Sets an Indicial object fully symmetric. Allows to set quickly a frequent property of tensors. This function then erases all properties of symmetry / antisymmetry and sets fullySymmetric to True.
 
virtual void setFullyAntiSymmetric ()
 Sets an Indicial object fully anti-symmetric. Allows to set quickly a frequent property of tensors. This function then erases all properties * of symmetry / antisymmetry and sets fullyAntiSymmetric to True.
 
virtual void addSymmetry (int i1, int i2)
 Add a symmetry between the i1^{th} and the i2^{th} indices. If those indices are anti-symmetric, an error is thrown. More...
 
virtual void addAntiSymmetry (int i1, int i2)
 Add an anti-symmetry between the i1^{th} and the i2^{th} indices. If those indices are symmetric, an error is thrown. More...
 
virtual int permut (int i1, int i2)
 Tries to permut indices at place i1 and i2. If those two indices have a symmetry property, indices are swaped and the symmetry is returned. Else the fnuction does nothing and returns 0. More...
 
virtual Expr getNumericalFactor () const
 Returns the numerical factor of the expression, i.e. returns C if the expression if of the form C*x (x having a numerical factor equal to 1), and return 1 else. More...
 
virtual int getNFactor () const
 
virtual csl::vector_expr getFactors () const
 Allows to get a std::vector of all terms than could factor the expression. More...
 
virtual std::optional< ExprgetTerm () const
 This function returns the same expression as *this but amputated of its numerical factor. Example: (4*cos(x) -> cos(x)). More...
 
virtual void getExponents (std::vector< Expr > const &factors, std::vector< Expr > &exponents) const
 Fills in a vector the exponents corresponding to some factors for the expression. More...
 
virtual bool checkIndexStructure (const std::vector< Index > &t_index) const
 Checks the compatibility of the index structure of an Indicial expression with another. In a sum, two terms must have exaclty the same index structure. More...
 
virtual bool checkIndexStructure (const std::initializer_list< Index > &index) const
 Checks the compatibility of the index structure of an Indicial expression with another. In a sum, two terms must have exaclty the same index structure. More...
 
virtual bool compareWithDummy (Expr_info expr, std::map< Index, Index > &constraints, bool keepAllCosntraints=false) const
 Comparison disregarding name of dummy indices, i.e. the two expressions * are equals even if dummy indices have not the same names in *this and * expr. More...
 
bool compareWithDummy (Expr_info expr, bool keepAllCosntraints=false) const
 
virtual int getParity (Expr_info t_variable) const
 Returns the parity property of the expression with respect to t_variable. More...
 
virtual bool askTerm (Expr_info expr, bool exact=false) const
 Check if expr can factor *this. More...
 
virtual std::optional< ExprfindSubExpression (Expr_info subExpression, const Expr &newExpression) const
 Searches a sub-expression and replaces it. More...
 
virtual int isPolynomial (Expr_info expr) const
 Determines if the expression is a mononomial term in expr, i.e. a term of the form C*expr^n with C independent of expr, n integer. More...
 
virtual bool hasContractionProperty (Expr_info B) const
 Tells (for an Indicial type) if there is a special contraction property with B. More...
 
virtual bool hasChainContractionProperty () const
 
virtual std::vector< ContractionChaingetContractionProperties () const
 
virtual Expr contraction (Expr_info B) const
 Applies a special contraction of indices. Before calling this function we must check that there is indeed a contraction by calling the function hasContractionProperty(). More...
 
virtual Expr contraction (const csl::vector_expr &chain) const
 
virtual long double evaluateScalar () const
 Evaluates the value of the Abstract. More...
 
virtual std::optional< Exprderive (Expr_info expr) const
 Calculates the derivative of the Abstract wrt another. More...
 
virtual std::optional< Exprcollect (std::vector< Expr > const &factors, bool full=false) const
 Collects terms in sum according to some factors given by the user. More...
 
virtual Expr suppressTerm (Expr_info expr) const
 Remove a factor from an expr, that must have been determined before. More...
 
virtual std::optional< ExprsuppressExponent (Expr const &factor, Expr const &exponent) const
 Returns the expression where the factor factor^exponent has been suppressed. More...
 
virtual std::optional< ExprgetComplexArgument () const
 Evaluates the argument in the complex plane of the Abstract and returns it. More...
 
virtual ExprapplySelfStructureOn (Expr &expr) const
 
virtual std::optional< ExprgetTransposed (const Space *space, bool applyProp=true) const
 
virtual std::optional< ExprgetTransposed (const std::vector< const Space *> &spaces, bool applyProp=true) const
 
virtual std::optional< ExprgetHermitianConjugate (const Space *space) const
 
virtual std::optional< ExprgetHermitianConjugate (const std::vector< const Space *> &spaces) const
 
virtual std::optional< ExprgetPolynomialTerm (Expr_info t_variable, int order) const
 Calculates and returns the polynomial term corresponding to *this with the variable t_variable at order order. In particular, this function assumes that the checks have already been made with the function isPolynomial(). More...
 
virtual csl::vector_expr getAlternateForms () const
 Calculates and returns all possible alternate forms of the expression in terms of simplifications. For example 1-sin^2(x) is one of the alternate forms of cos^2(x). More...
 
virtual Expr applyOperator (const Expr &operand, bool leaveEmpty=false) const
 Apply the operator on an operand, iif the expression is an operator. More...
 
virtual Expr division_own (const Expr &expr) const
 Contains implementation of special division for Numerical- and Polynomial-types. For polynomial, the euclidean division of two polynomials is implemented. More...
 
virtual Expr exponentiation_own (const Expr &expr) const
 Contains implementation of special exponentiation for Numerical- and Vectorial-types. More...
 
virtual Expr getRegularExpression () const
 Returns a regular expression from the polynomial, that is a sum where the different powers of the variable appear explicitely. More...
 
virtual Expr getSubVectorial (int iExcept) const
 Allows to pick a part of a Vectorial expression, excluding the iExcept^{th} element. More...
 
virtual Expr getSubVectorial (int iExcept, int jExcept) const
 Allows to pick a part of a Vectorial expression, excluding the [iExcept^{th},jExcept^{th}] element (useful for matrices). More...
 
virtual Expr determinant () const
 Returns the determinant of the object if it corresponds to a square matrix (or a scalar), 0 else. More...
 
virtual Expr trace () const
 
virtual Expr transpose () const
 Calculates and returns the transpose of a 2D matrix. More...
 
virtual Expr hermitian () const
 
virtual Expr inverseMatrix () const
 Calculates and returns the inverse of a 2D square matrix. The applied method is: A^{-1} = 1/det(A)*Com(A)^T. More...
 
virtual Expr getCanonicalPermutation () const
 
virtual Expr applyDiracDelta (const Expr &, const Expr &) const
 
virtual void operator= (double t_value)
 Equivalent to the setValue() function. More...
 
virtual bool operator== (int t_value) const
 
virtual bool operator== (double t_value) const
 
virtual bool operator!= (int t_value) const
 
virtual bool operator!= (double t_value) const
 
int testDummy (Expr_info expr) const
 
bool operator== (const Expr_c &expr) const
 
bool operator== (const Expr &expr) const
 
bool operator== (const Abstract &other) const
 
bool operator!= (Expr_info expr) const
 
bool operator!= (const Expr_c &expr) const
 Compares the Abstract with another. More...
 
bool operator!= (const Expr &expr) const
 
bool operator!= (const Abstract &other) const
 
virtual bool operator< (Expr_info expr) const =0
 Compares the simplicity of the expression to another. More...
 
bool operator< (const Expr_c &expr) const
 Compares the simplicity of the expression to another. More...
 
bool operator> (Expr_info expr) const
 Compares the simplicity of the expression to another. More...
 
bool operator> (const Expr_c &expr) const
 
bool operator<= (Expr_info expr) const
 
bool operator>= (Expr_info expr) const
 Compares the simplicity of the expression to another. More...
 
bool operator<= (const Expr_c &expr) const
 Compares the simplicity of the expression to another. More...
 
bool operator>= (const Expr_c &expr) const
 

Protected Attributes

int dim
 
int nArgs
 
csl::vector_expr argument
 
std::vector< int > shape
 

Additional Inherited Members

- Static Public Member Functions inherited from csl::Abstract
static std::string regularName (std::string const &name)
 
static std::string regularName (std::string_view name)
 
static std::string regularLiteral (std::string const &name)
 
static std::string regularLiteral (std::string_view name)
 

Member Function Documentation

◆ addition_own()

Expr csl::AbstractVectorial::addition_own ( const Expr expr) const
overridevirtual

Contains implementation of special addition for Numerical- and Vectorial-types.

Parameters
exprRight operrand of the addition.
Returns
The sum of the two operands.

Reimplemented from csl::Abstract.

◆ antisymmetrise()

Expr csl::AbstractVectorial::antisymmetrise ( ) const
overridevirtual

Calculates and returns the anti-symmetrization of a 2D matrix.

Returns
1/2*(A - A^T) for a matrix (2D) A.

Reimplemented from csl::Abstract.

Reimplemented in csl::Matrix.

◆ begin() [1/2]

csl::vector_expr::iterator csl::AbstractVectorial::begin ( )
overridevirtual
Returns
A csl::vector_expr::iterator at the beginning of argument for multi-argument expressions.

Reimplemented from csl::Abstract.

◆ begin() [2/2]

csl::vector_expr::const_iterator csl::AbstractVectorial::begin ( ) const
inlineoverridevirtual
Returns
A csl::vector_expr::iterator at the beginning of argument for multi-argument expressions.

Reimplemented from csl::Abstract.

◆ commutesWith()

bool csl::AbstractVectorial::commutesWith ( Expr_info  expr,
int  sign = -1 
) const
overridevirtual

Tells if the object commutes with expr.

Parameters
expr
Returns
True if *this commutes with expr.
False else.

Reimplemented from csl::Abstract.

◆ dependsExplicitlyOn()

bool csl::AbstractVectorial::dependsExplicitlyOn ( Expr_info  expr) const
overridevirtual

Check recursively if expr is present in the expression.

Parameters
exprExpression to search.
Returns
True if expr is found.
False else.

Reimplemented from csl::Abstract.

◆ dependsOn()

bool csl::AbstractVectorial::dependsOn ( Expr_info  expr) const
overridevirtual

Check recursively if the expression depends on expr.

Parameters
exprExpression to search.
Returns
True if a dependency in expr is found.
False else.

Reimplemented from csl::Abstract.

◆ dot()

Expr csl::AbstractVectorial::dot ( const Expr expr) const
overridevirtual

Returns the dot product of two Vectorial expressions.

Parameters
exprThe right operand of the dot product.
Returns
sum _k (*this)[i,j,...,k]*expr[k,l,m,...].

Reimplemented from csl::Abstract.

◆ end() [1/2]

csl::vector_expr::iterator csl::AbstractVectorial::end ( )
overridevirtual
Returns
A csl::vector_expr::iterator at the end of argument for multi-argument expressions.

Reimplemented from csl::Abstract.

◆ end() [2/2]

csl::vector_expr::const_iterator csl::AbstractVectorial::end ( ) const
inlineoverridevirtual
Returns
A csl::vector_expr::iterator at the end of argument for multi-argument expressions.

Reimplemented from csl::Abstract.

◆ evaluate()

optional< Expr > csl::AbstractVectorial::evaluate ( csl::eval::mode  user_mode = csl::eval::base) const
overridevirtual

Evaluates the Abstract.

Replaces all variables by their value and evaluating. This function must be used instead of evaluateScalar() when treating not only real scalars.* In particular (x=2, y=3) x+iy evaluates to 3+ 3i whereas evaluateScalar() would return 3.

Returns
The abstract result of the evaluation.

Implements csl::Abstract.

◆ expand()

optional< Expr > csl::AbstractVectorial::expand ( bool  full = false,
bool  inPlace = false 
) const
overridevirtual

Develops the Abstract.

This function concerns only products (and exponents) that will be flatten to give at the end a sum of independant terms.

Parameters
fullIf true the expandment is recursive through all the Abstract.
Returns
The expand Abstract.

Reimplemented from csl::Abstract.

◆ expand_if()

optional< Expr > csl::AbstractVectorial::expand_if ( std::function< bool(Expr const &)> const &  f,
bool  full = false,
bool  inPlace = false 
) const
overridevirtual

Develops the Abstract.

This function concerns only products (and exponents) that will be flatten to give at the end a sum of independant terms.

Parameters
fFunctions that returns a boolean that determines which arguments must be expanded in products.
fullIf true the expandment is recursive through all the Abstract.
Returns
The expand Abstract.

Reimplemented from csl::Abstract.

◆ factor() [1/2]

optional< Expr > csl::AbstractVectorial::factor ( bool  full = false) const
overridevirtual

Factors the Abstract.

This function tries to factor the Abstract wrt any factor. This will be more involved in calculation than the other factorizing function that takes the factor as a parameter. So this function must be used only if we don't know the factors we want at the end.

Parameters
fullIf true the factorization is recursive through all the Abstract.

Reimplemented from csl::Abstract.

◆ factor() [2/2]

optional< Expr > csl::AbstractVectorial::factor ( Expr_info  factor,
bool  full = false 
) const
overridevirtual

Factors the Abstract wrt a particular Abstract.

Parameters
factorAbstract wrt which we try to factor.
fullIf true the factorization is recursive through all the Abstract.

Reimplemented from csl::Abstract.

◆ getArgument() [1/2]

Expr const & csl::AbstractVectorial::getArgument ( int  iArg = 0) const
overridevirtual
Warning
This function must not be called for building blocks, one must check first that the expression has arguments.
Returns
The i^{th} argument of the expression.

Reimplemented from csl::Abstract.

◆ getArgument() [2/2]

Expr const& csl::AbstractVectorial::getArgument ( const std::vector< int > &  indices) const
overridevirtual

Allows to get specific arguments of expressions in multiple dimensions, by giving the indices in each dimension.

Warning
This function must not be called for building blocks, one must check first that the expression has arguments.
Returns
The argument {i,j,...} of the expression.

Reimplemented from csl::Abstract.

◆ getComplexConjugate()

optional< Expr > csl::AbstractVectorial::getComplexConjugate ( ) const
overridevirtual

Calculates and returns the complex conjugate of the expression.

Returns
{*this}.

Reimplemented from csl::Abstract.

◆ getComplexModulus()

std::optional< Expr > csl::AbstractVectorial::getComplexModulus ( ) const
overridevirtual

Evaluates the modulus in the complex plane of the Abstract and returns it.

Returns
The modulus part of the Abstract.

Reimplemented from csl::Abstract.

◆ getDim()

int csl::AbstractVectorial::getDim ( ) const
inlineoverridevirtual

Gives the dimension of the object.

Allows to know if we are manipulating a pure scalar (i.e. that can have a real value) or something else. There is the particular case of the Imaginary i that is considered as a scalar for simplicity but in reality cannot be evaluated with a real. Example: 1 + i cannot be reduced.

Returns
dim (a non memorized integer corresponding to the dimension of the abstract)

Reimplemented from csl::Abstract.

◆ getImaginaryPart()

Expr csl::AbstractVectorial::getImaginaryPart ( ) const
overridevirtual

Evaluates the imaginary part of the Abstract and returns it.

Returns
The imaginary part of the Abstract.

Reimplemented from csl::Abstract.

◆ getName()

std::string const & csl::AbstractVectorial::getName ( ) const
overridevirtual

Returns the Abstract's name.

Returns
name

Reimplemented from csl::Abstract.

◆ getNArgs()

int csl::AbstractVectorial::getNArgs ( int  axis = 0) const
overridevirtual

Returns the number of arguments of the expression. If the expression is a building block (AbstractBuildingBlock), this function returns 0.

Returns
The number of arguments of the expression.

Reimplemented from csl::Abstract.

◆ getPrimaryType()

csl::PrimaryType csl::AbstractVectorial::getPrimaryType ( ) const
inlineoverridevirtual

Gives the primary type of Abstract.

In the program this function is very often called. It allows different functions to know what type of expr they are manipulating (single number, scalar function with one argument, with multiple argumments, a Vector, etc) in order to do special treatments or simplifications.

Returns
type (a non memorized integer corresponding to the type of abstract)

Implements csl::Abstract.

◆ getProduct()

Expr csl::AbstractVectorial::getProduct ( ) const
overridevirtual

Calculates and returns the product of all elements in the Vectorial object.

Returns
The product of all elements.

Reimplemented from csl::Abstract.

◆ getRealPart()

std::optional< Expr > csl::AbstractVectorial::getRealPart ( ) const
overridevirtual

Evaluates the real part of the Abstract and returns it.

Returns
The real part of the Abstract.

Reimplemented from csl::Abstract.

◆ getShape()

vector< int > csl::AbstractVectorial::getShape ( ) const
overridevirtual

Accessor to the shape of the tensor in the form of a std::vector of integers.

Returns
shape.

Reimplemented from csl::Abstract.

◆ getSubVectorial()

Expr csl::AbstractVectorial::getSubVectorial ( const std::vector< int > &  exceptions) const
overridevirtual

Allows to pick a part of a Vectorial expression, excluding the iExcept^{th} element.

Parameters
iExceptElement to ignore.
Returns
The part of *this excluding iExcept.

Reimplemented from csl::Abstract.

◆ getSum()

Expr csl::AbstractVectorial::getSum ( ) const
overridevirtual

Calculates and returns the sum of all elements in the Vectorial object.

Returns
The sum of all elements.

Reimplemented from csl::Abstract.

◆ getVectorArgument()

const csl::vector_expr & csl::AbstractVectorial::getVectorArgument ( ) const
overridevirtual

Allows to get the entire std::vector of arguments of the expression.

Warning
This function must not be called for building blocks, one must check first that the expression has arguments.
Returns
The std::vector of argument.

Reimplemented from csl::Abstract.

◆ getVectorialModulus()

Expr csl::AbstractVectorial::getVectorialModulus ( ) const
overridevirtual

Returns the Vectorial modulus of the Vectorial object, that is defined here as the squared root of the sum of element squared. Example: {A_{11}^2+A_{12}^2+}.

Returns
The vectorial modulus of the expression.

Reimplemented from csl::Abstract.

◆ matchShape()

bool csl::AbstractVectorial::matchShape ( Expr_info  expr,
bool  exact = false 
) const
overridevirtual

In the case of a vectorial-type expression, this function checks if the shape of expr matches itself.

If exact is true, the function search an exact match i.e. either the two shapes are exactly equal or one of the two objects is a scalar. If exact is false, this function only search for a possible dot product between the two expressions, and see if the last axis of *this matches the first of expr (or if one of the two objects is scalar also). Then, a product _k (*this)[i,j,...,k]*expr[k,l,m,...] is possible.

Parameters
exprExpression of which we compare the shape.
exactBoolean than specifies if we need an exact match or not.
Returns
True if the two shapes correspond.
False else.

Reimplemented from csl::Abstract.

◆ multiplication_own()

Expr csl::AbstractVectorial::multiplication_own ( const Expr expr,
bool  side = 1 
) const
overridevirtual

Contains implementation of special multiplication for Numerical- and Vectorial-types.

Parameters
exprRight operrand of the product.
Returns
The product of the two operands.

Reimplemented from csl::Abstract.

◆ operator==()

bool csl::AbstractVectorial::operator== ( Expr_info  expr) const
overridevirtual

Compares the Abstract with another.

Here if two Abstracts have the same name, the function will return true even if they are not mathematically equal. So beware not to name different things the same way.

Parameters
exprAbstract to compare.
Returns
True if the two Abstracts are the same (or have the same name).
False else.

Implements csl::Abstract.

◆ operator[]() [1/2]

Expr & csl::AbstractVectorial::operator[] ( int  iArg)
overridevirtual

Access operator for multi-argument expressions, returns a reference so this function is not const.

Parameters
iArgIndex of the argument to get.
Returns
A reference to argument[iArg].

Reimplemented from csl::Abstract.

◆ operator[]() [2/2]

Expr const & csl::AbstractVectorial::operator[] ( int  iArg) const
overridevirtual

Access operator for multi-argument expressions, equivalent to the function getArgument().

Parameters
iArgIndex of the argument to get.
Returns
argument[iArg].

Reimplemented from csl::Abstract.

◆ print()

void csl::AbstractVectorial::print ( int  mode = 0,
std::ostream &  out = std::cout,
bool  lib = false 
) const
overridevirtual

Displays the abstract in standard output.

Parameters
modeTells if the Abstract is printed alone (default) or in another expr.

Implements csl::Abstract.

◆ printLaTeX()

string csl::AbstractVectorial::printLaTeX ( int  mode = 0) const
overridevirtual

Creates a LaTeX output for the Abstract.

Parameters
modeTells if the Abstract is printed alone (default) or in another expr.
Returns
The string corresponding to the LaTeX output.

Reimplemented from csl::Abstract.

◆ setArgument() [1/2]

void csl::AbstractVectorial::setArgument ( const Expr expr,
int  iArg = 0 
)
overridevirtual

Sets the argument at position iArg (default=0).

Parameters
exprExpression that replaces the argument.
iArgthe position of the argument to change.

Reimplemented from csl::Abstract.

◆ setArgument() [2/2]

void csl::AbstractVectorial::setArgument ( const Expr expr,
const std::vector< int > &  indices 
)
overridevirtual

Sets the argument at position {i,j,...} for multi-dimensions expressions.

Parameters
exprExpression that replaces the argument.
indicesAn std::vector containing the series of indices corresponding to the argument to replace.

Reimplemented from csl::Abstract.

◆ setVectorArgument()

void csl::AbstractVectorial::setVectorArgument ( const csl::vector_expr &  t_argument)
overridevirtual

Replaced the entire std::vector of argument.

Parameters
t_argumentstd::vector of expressions to copy.

Reimplemented from csl::Abstract.

◆ symmetrise()

Expr csl::AbstractVectorial::symmetrise ( ) const
overridevirtual

Calculates and returns the symmetrization of a 2D matrix.

Returns
1/2*(A + A^T) for a matrix (2D) A.

Reimplemented from csl::Abstract.

Reimplemented in csl::Matrix.

◆ tensordot()

Expr csl::AbstractVectorial::tensordot ( const Expr expr) const
overridevirtual

Returns the tensordot of two Vectorial expressions.

Parameters
exprThe right operand of the tensordot
Returns
The tensor dot of *this and expr.

Reimplemented from csl::Abstract.

◆ trace()

Expr csl::AbstractVectorial::trace ( int  axis1,
int  axis2 
) const
overridevirtual

Calculates the trace over the axis axis1 and axis2 of a tensor. axis1 and axis2 can be the same, in which case the trace just corresponds to the sum over this particular axis.

Parameters
axis1First axis to contract.
axis2Second axis to contract.
Returns
the trace over axis axis1 and axis2.

Reimplemented from csl::Abstract.


The documentation for this class was generated from the following files: