Documentation of CSL
Static Public Member Functions | Static Public Attributes | Friends
csl::Comparator Class Reference

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...

#include <comparison.h>

Static Public Member Functions

static Expr dummy (int n, csl::Type type=csl::Type::NoType)
 
static bool dummyComparison (Expr_info expr, Expr_info dummyExpr)
 Compares a regular expression to an expression containing Arbitrary objects. More...
 
static bool dummyComparison (Expr const &expr, Expr const &dummyExpr)
 
static bool dummyVecIntComparison (Expr_info A, Expr_info B)
 
static bool getFreeIndexComparisonActive ()
 
static void setFreeIndexComparisonActive (bool t_activ)
 
static std::string dummyName ()
 
static bool freeIndexComparison (const Abstract *A, Expr_info B)
 Compares two expressions considering that the index structures must match no matter the names of free indices. More...
 
static bool compare (const Index &A, const Index &B)
 Compares two indices. Depends on the bare comparison and the possible maps existing for the two indices. More...
 
static void clear ()
 Clears all maps and correspondances.
 
static bool getDummyComparisonActive ()
 
static bool getDummyVecIntComparisonActive ()
 
static void setDummyComparisonActive (bool state)
 
static void setDummyVecIntComparisonActive (bool state)
 

Static Public Attributes

static bool freeIndexComparisonActive = false
 Tells if the index comparison is active or not. If true, two different indices (even free indices) can be equal. This is useful for comparing structures, independently of the names of the indices.
 
static std::map< Index, IndexindexCorrespondance = std::map<Index,Index>()
 Correspondance between indices during the comparison. Allows to keep track of all index comparisons we have done when the indices were not equal.
 
static bool dummyVecIntComparisonActive = false
 

Friends

class Arbitrary
 

Detailed Description

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.

Member Function Documentation

◆ compare()

bool csl::Comparator::compare ( const Index A,
const Index B 
)
static

Compares two indices. Depends on the bare comparison and the possible maps existing for the two indices.

Parameters
AFirst index.
BSecond index.
Returns
The result of the comparison.

◆ dummy()

Expr csl::Comparator::dummy ( int  n,
csl::Type  type = csl::Type::NoType 
)
static

Generate and returns an Arbitrary object.

Parameters
nNumber of the generated Arbitrary.
typeType of the generated Arbitrary.
Returns
The generated Arbitrary.

◆ dummyComparison()

bool csl::Comparator::dummyComparison ( Expr_info  expr,
Expr_info  dummyExpr 
)
static

Compares a regular expression to an expression containing Arbitrary objects.

Parameters
exprRegular expression, in the form of a **const Abstract*** so that it can be called by an object with itself in parameter in a const method.
dummyExprExpression containing Arbitrary objects.
Returns
The result of the comparison.

◆ dummyName()

string csl::Comparator::dummyName ( )
static
Returns
The string that is given as a name to all Arbitrary objects in the program.

◆ freeIndexComparison()

bool csl::Comparator::freeIndexComparison ( const Abstract A,
Expr_info  B 
)
static

Compares two expressions considering that the index structures must match no matter the names of free indices.

Parameters
AFirst expression in the form of a **const Abstract*** so that it can be called by an object with itself in parameter in a const method.
BSecond expression.

◆ getDummyComparisonActive()

static bool csl::Comparator::getDummyComparisonActive ( )
inlinestatic
Returns
dummyComparisonActive.

◆ getFreeIndexComparisonActive()

static bool csl::Comparator::getFreeIndexComparisonActive ( )
inlinestatic
Returns
freeIndexComparisonActive.

◆ setDummyComparisonActive()

void csl::Comparator::setDummyComparisonActive ( bool  state)
static
Parameters
stateBoolean that will replace dummyComparisonActive.

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