23 #ifndef COM_DAFER45_TBTK_INDEX 24 #define COM_DAFER45_TBTK_INDEX 33 IDX_SUM_ALL = -1, IDX_ALL = -1,
47 Index(std::initializer_list<int> i) : indices(i){};
50 Index(std::vector<int> i) : indices(i){};
63 bool equals(
const Index &index,
bool allowWildcard =
false)
const;
66 int&
at(
unsigned int n);
69 const int&
at(
unsigned int n)
const;
72 unsigned int size()
const;
106 std::vector<int> indices;
111 for(
unsigned int n = 0; n < indices.size(); n++){
120 std::string str =
"{";
121 for(
unsigned int n = 0; n < indices.size(); n++){
124 str += std::to_string(indices.at(n));
132 if(indices.size() == index.indices.size()){
133 for(
unsigned int n = 0; n < indices.size(); n++){
134 if(indices.at(n) != index.indices.at(n)){
139 indices.at(n) == IDX_ALL ||
140 index.indices.at(n) == IDX_ALL
157 return indices.at(n);
161 return indices.at(n);
165 return indices.size();
169 indices.push_back(subindex);
173 int first = indices.at(0);
174 indices.erase(indices.begin());
180 int last = indices.back();
void print() const
Definition: Index.h:109
bool equals(const Index &index, bool allowWildcard=false) const
Definition: Index.h:131
Index getUnitRange()
Definition: Index.cpp:83
unsigned int size() const
Definition: Index.h:164
static std::ostream out
Definition: Streams.h:37
friend bool operator<(const Index &i1, const Index &i2)
Definition: Index.cpp:35
Index(std::vector< int > i)
Definition: Index.h:50
Index(const Index &index)
Definition: Index.h:53
int popFront()
Definition: Index.h:172
friend bool operator>(const Index &i1, const Index &i2)
Definition: Index.cpp:59
void push_back(int subindex)
Definition: Index.h:168
Definition: AbstractOperator.h:26
Index getSubIndex(int first, int last)
Definition: Index.cpp:92
Index(std::initializer_list< int > i)
Definition: Index.h:47
int & at(unsigned int n)
Definition: Index.h:156
std::string toString() const
Definition: Index.h:119
int popBack()
Definition: Index.h:179