23 #ifndef INDEX_H_INCLUDED 24 #define INDEX_H_INCLUDED 27 #include <string_view> 79 using ID_type =
unsigned int;
86 const Space* space =
nullptr;
112 explicit Index(
const std::string& t_name,
113 unsigned short t_id = 0);
130 Index(
const std::string& t_name,\
131 const Space* t_space,
132 unsigned short t_id = 0);
139 std::string_view getName()
const;
141 std::string getIndexCodeName()
const;
143 inline ID_type getID()
const {
159 return nameOrValue >= 0;
189 Index rename()
const;
195 Index getFlipped()
const;
200 void setName(
const std::string& t_name);
202 void setID(ID_type t_id);
208 void setSpace(
const Space* t_space);
215 void setValue(
char t_value);
220 void setSign(
bool t_sign);
228 void setFree(
bool t_free);
244 bool testContraction(
const Index& t_index)
const;
255 std::string printLaTeX()
const;
257 void printDefinition(
269 Index& operator=(
const Index& index) =
default;
276 Index& operator=(
int t_value);
288 bool compareWithDummy(
const Index& t_index)
const;
300 bool compareWithoutSign(
const Index& t_index)
const;
310 bool exactMatch(
const Index& t_index)
const;
314 Index operator++(
int);
431 friend std::ostream& operator<<(std::ostream& fout,
const Index& index);
434 std::vector<Index> integerToIndices(
const std::vector<int>& indices);
474 IMPLEMENTS_STD_VECTOR_NO_OP(
Index, index)
482 std::vector<Index> index;
515 explicit IndexStructure(
const std::initializer_list<Index>& structure);
534 std::vector<Index>
const &getIndex()
const;
536 const std::vector<Index>& getIndexView()
const;
541 std::vector<Index>& getIndex();
552 std::vector<Index>::const_iterator find(
const Index& t_index)
const;
554 std::vector<Index>::iterator find(
const Index& t_index);
574 IndexStructure getPermutation(
const std::vector<int>& permutation)
const;
583 void setIndex(
const Index& newIndex,
int iIndex=0);
672 std::map<Index,Index>& constraints,
673 bool keepAllCosntraints =
false)
const;
764 Index operator[](
int i)
const;
773 Index& operator[](
int i);
783 friend std::ostream& operator<<(std::ostream& fout,
794 index(t_index.index){}
TensorType
Type of TensorElement.
Definition: index.h:60
Namespace for csl library.
Definition: abreviation.h:34
char getValue() const
Definition: index.h:151
Index operator!(const Index &index)
operator!, unary operator on Index that change the free property of the Index.
Definition: index.cpp:378
bool operator &=(const Expr &a, const Expr &b)
see Abstract::operator&=()
Index object that is used for indicial objects.
Definition: index.h:75
bool operator<=(const Expr &a, const Expr &b)
see Abstract::operator<=()
Definition: abstract.cpp:1416
Definition: diagonalization.h:32
Expr operator+(const Expr &a, const Expr &b)
Shortcut function that allows to use arithmetic operator + with Expr (== shared_ptr<Abstract>).
Definition: abstract.cpp:1298
bool getFree() const
Definition: index.h:166
bool operator|=(const Expr &a, const Expr &b)
see Abstract::operator|=()
bool operator>(const Expr &a, const Expr &b)
see Abstract::operator>()
Definition: abstract.cpp:1419
bool operator>=(const Expr &a, const Expr &b)
see Abstract::operator>=()
Definition: abstract.cpp:1413
cslIndex::Type getType() const
Definition: index.h:173
bool getSign() const
Definition: index.h:158
~IndexStructure()
Destructor.
Definition: index.h:529
Vector space that has a name, a dimension, a delta tensor and possibly a non-trivial metric...
Definition: space.h:64
bool operator==(const Expr &a, const Expr &b)
see Abstract::operator==()
Definition: abstract.cpp:1398
Encapsulate types of indices and tensor in a small namespace.
~Index()
Destructor.
Definition: index.h:137
Type
Definition: index.h:48
const Space * getSpace() const
Definition: index.h:185
bool operator<(const Expr &a, const Expr &b)
see Abstract::operator<()
Definition: abstract.cpp:1423
bool operator!=(const Expr &a, const Expr &b)
see Abstract::operator!=()
Definition: abstract.cpp:1404
Manages a std::vector of Index, to be used by an TensorElement.
Definition: index.h:472
IndexStructure()
Default constructor, empty structure.
Definition: index.h:790