45 #ifndef XERUS_DISABLE_RUNTIME_CHECKS 55 static std::atomic<uint64> idThreadInitCounter;
58 static thread_local
uint64 idCounter;
94 explicit Index(
const uint64 _valueId,
const size_t _span) noexcept;
97 explicit Index(
const uint64 _valueId,
const size_t _span,
const Flag _flag1) noexcept;
105 void set_span(
const size_t _degree);
119 void open(
const bool _open);
155 static bool all_open(
const std::vector<Index>& _indices);
static bool all_open(const std::vector< Index > &_indices)
: Checks whether all indices in _indices are open. This is naturally only usefull for assinged indice...
size_t actual_span(const size_t _degree) const
Returns the span this index actually represents in a tensor of given order.
Flag
Enum defining the possible flags an Index my possess.
bool open() const
Checks whether the index is open.
The main namespace of xerus.
Index operator^(const size_t _span) const
: Allow the creation of Indices covering more than one dimension using the power operator. E.g. A(i^2) = B(i^2) + C(i^2), defines A as the entriewise sum of the matrices B and C.
size_t fixed_position() const
: Returns the fixed position of a fixed index.
std::ostream & operator<<(std::ostream &_out, const xerus::Index &_idx)
Allows to pretty print indices, giving the valueId and span.
bool operator==(const Index &_a, const Index &_b)
Two Indices are equal if their valueId coincides. Fixed indices are never equal.
std::bitset< NUM_FLAGS > flags
Bitset of all possible flags the index may possess.
Index & operator=(const Index &)=default
Indices are default assignable.
void set_span(const size_t _degree)
Returns the span this index actually represents in a tensor of given order.
uint64 valueId
Unqiue ID of the index. In case the fixed flag is set, this is the fixed position.
size_t assingedDimension
The product of the external dimensions this index correstponds to. Only set for assinged indices...
bool operator<(const Index &_a, const Index &_b)
The Comparision operator is needed for indices to be orderable in std::set, the valueId is used...
Index operator/(const size_t _span) const
: Allow the creation of Indices covering an x-th fraction of the indices. E.g. A(i&0) = B(i/2...
bool operator!=(const Index &_a, const Index &_b)
Two Indices are equal if their valueId coincides. Fixed indices are never equal.
Header file for shorthand notations that are xerus specific but used throughout the library...
Class used to represent indices that can be used to write tensor calculations in index notation...
Index operator &(const size_t _span) const
: Allow the creation of Indices covering all but x dimensions using the and operator. E.g. A() = B(i&0) * C(i&0), defines A as the full contraction between B and C, indifferent of the actual degree of B and C.
size_t dimension() const
Returns the (mult)Dimension assinged to this index.
size_t span
The span states how many dimensions are covered by the index.
bool fixed() const
Checks whether the Index represents a fixed number.
Index()
Empty constructor that creates a new Index with new ID. Use this to create indices.