12 #ifndef HAMMER_MATH_MULTIDIM_BLOCKINDEXING
13 #define HAMMER_MATH_MULTIDIM_BLOCKINDEXING
25 namespace MultiDimensional {
29 using EntryType = std::vector<std::pair<SharedTensorData, bool>>;
80 using DotGroupType = std::tuple<IndexList, IndexList, IndexPairList>;
131 std::vector<IndexList::const_iterator>
splitIndices(IndexList::const_iterator first, IndexList::const_iterator last)
const;
138 bool checkValidIndices(IndexList::const_iterator first, IndexList::const_iterator last)
const;
151 bool sortedBySecond =
true)
const;
163 template <
typename S>
178 std::vector<std::tuple<IndexList, std::vector<bool>,
PositionType>>
182 const IndexList& outerShiftsInnerPositions,
const std::vector<bool>& isOuter,
183 IndexList& innerList, std::vector<bool>& innerAdded,
184 bool shouldCompare =
false)
const;
198 template <
typename S>
IndexType labelIndex(IndexLabel label) const
OuterElemIterator(const EntryType &entry)
bool operator!=(const OuterElemIterator &lhs, const OuterElemIterator &rhs)
std::pair< IndexType, IndexType > IndexPair
bool isSame(const OuterElemIterator &other) const
bool checkValidIndices(const IndexList &indices) const
check that the indices are within range for each component
std::tuple< IndexList, IndexList, IndexPairList > DotGroupType
IndexPairList getSameLabelPairs(const LabelsList &otherLabels, const UniqueLabelsList &indices, bool sortedBySecond=true) const
returns the position of the indices in the two tensor (this and another) that can be contracted toget...
std::vector< IndexList > splitIndices(const IndexList &indices) const
std::vector< IndexPair > IndexPairList
IndexType dim(IndexType index) const
dimension of a specific component
IndexList dims() const
get the dimensions of all the indices at once
PositionType position(IndexType idx) const
UniqueLabelsList spinIndices() const
returns only the labels corresponding to spin indices
bool isSameLabelShape(const LabelsList &otherLabels, const IndexList &otherIndices) const
OuterElemIterator begin() const
void incrementEntry(size_t position, int n)
std::vector< std::pair< SharedTensorData, bool >> EntryType
std::complex< double > ElementType
bool operator==(const OuterElemIterator &lhs, const OuterElemIterator &rhs)
PositionType splitPosition(const OuterElemIterator ¤tPosition, const DotGroupType &chunk, const IndexList &outerShiftsInnerPositions, const std::vector< bool > &isOuter, IndexList &innerList, std::vector< bool > &innerAdded, bool shouldCompare=false) const
const LabelsList & labels() const
get the labels of all the indices at once
ContainerList _containers
Forward declarations of types used in the tensor classes.
size_t numSubIndexing() const
std::vector< ISingleContainer * > ContainerList
PositionType buildFullPosition(const OuterElemIterator ¤t, const IndexList &chunkIndices) const
std::vector< ISingleContainer::NonZeroIt > IteratorList
std::vector< LabeledIndexing< AlignedIndexing > > _subIndexing
OuterElemIterator end() const
std::vector< DotGroupType > DotGroupList
std::vector< IndexType > IndexList
IndexPairList getOppositeLabelPairs(const UniqueLabelsList &indices) const
returns the position of the indices that can be traced together, given a set of allowed index labels ...
OuterElemIterator & operator=(const OuterElemIterator &)=delete
std::vector< PositionType > _splitPads
IndexLabel
label identifiers of tensor indices they are used to determine which indices can be contracted togeth...
LabeledIndexing< AlignedIndexing > _globalIndexing
std::vector< std::tuple< IndexList, std::vector< bool >, PositionType > > processShifts(const DotGroupList &chunks, IndexPairMember which) const
BlockIndexing & operator=(const BlockIndexing &)=default
Interface class for single container data structure.
std::vector< IndexType > _splitIndices
IContainer::ElementType operator*()
size_t rank() const
rank of the tensor
const LabeledIndexing< AlignedIndexing > & getSubIndexing(IndexType position) const
std::vector< IndexLabel > LabelsList
PositionType numValues() const
the number of elements (product of all the dimensions)
std::set< IndexLabel > UniqueLabelsList
LabelsList labels() const
get the labels of all the indices at once
bool isAligned(IndexType idx) const
size_t maxSubRank() const
IndexPair getElementIndex(IndexType position) const
OuterElemIterator & operator++()