12 #ifndef HAMMER_MATH_MULTIDIM_ALIGNEDINDEXING
13 #define HAMMER_MATH_MULTIDIM_ALIGNEDINDEXING
25 namespace MultiDimensional {
82 bool checkValidIndices(IndexList::const_iterator first, IndexList::const_iterator last)
const;
110 const std::vector<bool>& isOuter,
IndexList& innerList, std::vector<bool>& innerAdded,
111 bool shouldCompare =
false)
const;
155 template <
typename BasicIndexing>
175 template <
typename BasicIndexing>
void calcMasks(const IndexList &dimensions, IndexList &masks) const
std::vector< PosIndexPair > PosIndexPairList
AlignedIndexing & operator=(const AlignedIndexing &)=default
~AlignedIndexing()=default
std::vector< IndexPair > IndexPairList
void calcUnaligned(const IndexList &dimensions, const IndexList &pads, PosIndexPairList &unaligned) const
PosIndexPairList _unalignedEntries
PositionType extendPosition(PositionType position, PositionType stride, IndexType indexPosition, IndexType indexValue) const
extends an unaligned absolute position from a rank N-1 tensor to the corresponding aligned position f...
IndexList _alignPads
the strides for each tensor index (necessary to convert coordinates to position in _data) ...
IndexType ithIndexInPos(PositionType alignedPosition, IndexType indexPosition) const
extract the value of the i-th index from an absolute aligned position
PositionType numValues() const
the number of elements (product of all the dimensions)
Forward declarations of types used in the tensor classes.
const IndexList & dims() const
get the dimensions of all the indices at once
size_t rank() const
rank of the tensor
PositionType alignedPosToPos(PositionType alignedPosition) const
convert the absolute aligned position to the absolute unaligned position that can be used with a Sequ...
std::vector< IndexType > IndexList
PositionType calcPadding(const IndexList &dimensions, IndexList &pads) const
PositionType _maxAlignedIndex
PositionType posToAlignedPos(PositionType position) const
convert the absolute unaligned position (e.g.
IndexType dim(IndexType index) const
dimension of a specific component
PositionType maxIndex(bool aligned=true) const
get the maximum allowed value for the absolute position
bool checkValidIndices(const IndexList &indices) const
check that the indices are within range for each component
void posToIndices(PositionType alignedPosition, IndexList &result) const
convert the absolute aligned position (in row-major convention) into the list of indices ...
IndexList _dimensions
the dimensions of each tensor index
PositionType splitPosition(PositionType alignedPosition, const IndexList &outerShiftsInnerPositions, const std::vector< bool > &isOuter, IndexList &innerList, std::vector< bool > &innerAdded, bool shouldCompare=false) const
split an absolute aligned position by separating contracted and uncontracted indices and returning th...
PositionType indicesToPos(const IndexList &indices) const
convert the indices into the (aligned) position indicizing a sparse tensor container organized as row...
PositionType extendAlignedPosition(PositionType alignedPosition, IndexType indexPosition, IndexType indexValue) const
extends an aligned absolute position from a rank N-1 tensor to the corresponding aligned position for...
IndexList _alignMasks
the strides for each tensor index (necessary to convert coordinates to position in _data) ...
bool isSameShape(const BasicIndexing &other) const
std::tuple< IndexList, std::vector< bool >, PositionType > processShifts(const IndexPairList &pairs, IndexPairMember which) const
build the input lists necessary for calling splitPosition based on which indices are being contracted...