Go to the documentation of this file.
23 #ifndef COM_DAFER45_TBTK_INDEX
24 #define COM_DAFER45_TBTK_INDEX
54 Index(std::initializer_list<Subindex> i) : indices(i){};
67 Index(std::vector<Subindex> i) : indices(i){};
101 Index(
const std::vector<std::vector<Subindex>> &indexList);
109 Index(std::initializer_list<Index> indexList);
115 Index(std::vector<Index> indexList);
122 Index(
const std::string &indexString);
150 bool equals(
const Index &index,
bool allowWildcard =
false)
const;
184 void reserve(
unsigned int size);
242 std::vector<Index>
split()
const;
275 std::ostream &stream,
336 std::vector<Subindex> indices;
341 for(
unsigned int n = 0; n < indices.size(); n++){
350 std::string str =
"{";
351 bool isFirstIndex =
true;
352 for(
unsigned int n = 0; n < indices.size(); n++){
357 isFirstIndex =
false;
362 str +=
"IDX_SUM_ALL";
378 "This should never happen, contact the"
397 str += std::to_string(subindex);
412 if(indices.size() == index.indices.size()){
413 for(
unsigned int n = 0; n < indices.size(); n++){
414 if(indices.at(n) != index.indices.at(n)){
419 indices.at(n).isWildcard() ||
420 index.indices.at(n).isWildcard()
425 indices.at(n).isLabeledWildcard()
435 && index.indices.at(c)
436 != index.indices.at(n)
443 index.indices.at(n).isLabeledWildcard()
452 == index.indices.at(n)
475 return indices.at(n);
479 return indices.at(n);
483 return indices.size();
487 indices.reserve(size);
491 indices.push_back(subindex);
496 indices.erase(indices.begin());
509 indices.insert(indices.begin() + n, subindex);
514 indices.erase(indices.begin() + n);
520 std::vector<Index> components;
521 components.push_back(
Index());
522 for(
unsigned int n = 0; n < indices.size(); n++){
523 if(indices[n].isIndexSeparator())
524 components.push_back(
Index());
526 components.back().pushBack(indices[n]);
533 for(
unsigned int n = 0; n < indices.size(); n++)
534 if(indices.at(n) < 0)
541 return indices[subindex];
545 return indices[subindex];
549 return sizeof(*this) +
sizeof(int)*indices.capacity();
bool isSummationIndex() const
Definition: Subindex.h:437
std::string toString() const
Definition: Index.h:349
std::string serialize(Serializable::Mode mode) const
Subindex getWildcardLabel() const
Definition: Subindex.h:423
bool equals(const Index &index, bool allowWildcard=false) const
Definition: Index.h:411
bool isIndexSeparator() const
Definition: Subindex.h:449
bool isLabeledWildcard() const
Definition: Subindex.h:419
unsigned int getSizeInBytes() const
Definition: Index.h:548
Index getSubIndex(int first, int last) const
Subindex popFront()
Definition: Index.h:494
Index(std::initializer_list< Subindex > i)
Definition: Index.h:54
Index(std::vector< Subindex > i)
Definition: Index.h:67
bool isRangeIndex() const
Definition: Subindex.h:441
bool isWildcard() const
Definition: Subindex.h:415
bool isSpinIndex() const
Definition: Subindex.h:445
friend std::ostream & operator<<(std::ostream &stream, const Index &index)
Definition: Index.h:405
Abstract base class for serializable objects.
Subindex erase(unsigned int n)
Definition: Index.h:512
Subindex popBack()
Definition: Index.h:501
static std::ostream out
Definition: Streams.h:70
Index(const Index &index)
Definition: Index.h:79
An entry in an Index.
Definition: Subindex.h:91
std::ostream & operator<<(std::ostream &stream, const HoppingAmplitude &hoppingAmplitude)
Definition: HoppingAmplitude.h:315
friend bool operator<(const Index &i1, const Index &i2)
Index()
Definition: Index.h:48
void print() const
Definition: Index.h:339
std::vector< Index > split() const
Definition: Index.h:519
void insert(unsigned int n, Subindex subindex)
Definition: Index.h:508
friend bool operator>(const Index &i1, const Index &i2)
bool isPatternIndex() const
Definition: Index.h:532
unsigned int getSize() const
Definition: Index.h:482
void pushBack(Subindex subindex)
Definition: Index.h:490
Subindex & at(unsigned int n)
Definition: Index.h:474
Mode
Definition: Serializable.h:47
Physical index.
Definition: Index.h:44
void reserve(unsigned int size)
Definition: Index.h:486
Subindex & operator[](unsigned int subindex)
Definition: Index.h:540