Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hammer::MultiDimensional::BlockIndexing Class Reference

#include <BlockIndexing.hh>

+ Collaboration diagram for Hammer::MultiDimensional::BlockIndexing:

Public Member Functions

 BlockIndexing ()
 
 BlockIndexing (const std::vector< IndexList > &dims, const std::vector< LabelsList > &labels)
 
 BlockIndexing (LabeledIndexing< AlignedIndexing > left, LabeledIndexing< AlignedIndexing > right)
 
 BlockIndexing (const BlockIndexing &)=default
 
 BlockIndexing (BlockIndexing &&)=default
 
BlockIndexingoperator= (const BlockIndexing &)=default
 
BlockIndexingoperator= (BlockIndexing &&)=default
 
 ~BlockIndexing ()=default
 
size_t rank () const
 rank of the tensor More...
 
IndexType dim (IndexType index) const
 dimension of a specific component More...
 
IndexType dim (IndexLabel label) const
 dimension of a specific component by label. More...
 
LabelsList labels () const
 get the labels of all the indices at once More...
 
UniqueLabelsList spinIndices () const
 returns only the labels corresponding to spin indices More...
 
IndexList dims () const
 get the dimensions of all the indices at once More...
 
PositionType numValues () const
 the number of elements (product of all the dimensions) More...
 
std::vector< IndexListsplitIndices (const IndexList &indices) const
 
std::vector
< IndexList::const_iterator > 
splitIndices (IndexList::const_iterator first, IndexList::const_iterator last) const
 
bool checkValidIndices (const IndexList &indices) const
 check that the indices are within range for each component More...
 
bool checkValidIndices (IndexList::const_iterator first, IndexList::const_iterator last) const
 
bool checkValidIndices (const std::vector< IndexList > &splits) const
 
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 together, given a set of allowed index labels More...
 
IndexPairList getOppositeLabelPairs (const UniqueLabelsList &indices) const
 returns the position of the indices that can be traced together, given a set of allowed index labels More...
 
IndexType labelIndex (IndexLabel label) const
 
bool isSameLabelShape (const LabelsList &otherLabels, const IndexList &otherIndices) const
 
template<typename S >
bool isSameLabelShape (const LabeledIndexing< S > &other) const
 
bool isSameLabelShape (const BlockIndexing &other, bool includeBlockShapes=false) const
 
void flipLabels ()
 
IndexPair getElementIndex (IndexType position) const
 
const LabeledIndexing
< AlignedIndexing > & 
getSubIndexing (IndexType position) const
 
size_t numSubIndexing () const
 
size_t maxSubRank () const
 
std::vector< std::tuple
< IndexList, std::vector< bool >
, PositionType > > 
processShifts (const DotGroupList &chunks, IndexPairMember which) const
 
PositionType splitPosition (const OuterElemIterator &currentPosition, const DotGroupType &chunk, const IndexList &outerShiftsInnerPositions, const std::vector< bool > &isOuter, IndexList &innerList, std::vector< bool > &innerAdded, bool shouldCompare=false) const
 
PositionType buildFullPosition (const OuterElemIterator &current, const IndexList &chunkIndices) const
 

Private Member Functions

void calc ()
 

Private Attributes

std::vector< LabeledIndexing
< AlignedIndexing > > 
_subIndexing
 
std::vector< IndexType_splitIndices
 
std::vector< PositionType_splitPads
 
LabeledIndexing< AlignedIndexing_globalIndexing
 

Detailed Description

Definition at line 83 of file BlockIndexing.hh.

Constructor & Destructor Documentation

Hammer::MultiDimensional::BlockIndexing::BlockIndexing ( )

Definition at line 28 of file BlockIndexing.cc.

Hammer::MultiDimensional::BlockIndexing::BlockIndexing ( const std::vector< IndexList > &  dims,
const std::vector< LabelsList > &  labels 
)

Definition at line 32 of file BlockIndexing.cc.

Hammer::MultiDimensional::BlockIndexing::BlockIndexing ( LabeledIndexing< AlignedIndexing left,
LabeledIndexing< AlignedIndexing right 
)

Definition at line 41 of file BlockIndexing.cc.

Hammer::MultiDimensional::BlockIndexing::BlockIndexing ( const BlockIndexing )
default
Hammer::MultiDimensional::BlockIndexing::BlockIndexing ( BlockIndexing &&  )
default
Hammer::MultiDimensional::BlockIndexing::~BlockIndexing ( )
default

Member Function Documentation

PositionType Hammer::MultiDimensional::BlockIndexing::buildFullPosition ( const OuterElemIterator current,
const IndexList chunkIndices 
) const

Definition at line 269 of file BlockIndexing.cc.

void Hammer::MultiDimensional::BlockIndexing::calc ( )
private

Definition at line 183 of file BlockIndexing.cc.

bool Hammer::MultiDimensional::BlockIndexing::checkValidIndices ( const IndexList indices) const

check that the indices are within range for each component

Parameters
[in]indicesthe element indices
Returns
true if all indices are OK

Definition at line 85 of file BlockIndexing.cc.

bool Hammer::MultiDimensional::BlockIndexing::checkValidIndices ( IndexList::const_iterator  first,
IndexList::const_iterator  last 
) const

Definition at line 89 of file BlockIndexing.cc.

bool Hammer::MultiDimensional::BlockIndexing::checkValidIndices ( const std::vector< IndexList > &  splits) const

Definition at line 93 of file BlockIndexing.cc.

IndexType Hammer::MultiDimensional::BlockIndexing::dim ( IndexType  index) const

dimension of a specific component

Parameters
[in]indexthe component index
Returns
the dimension

Definition at line 50 of file BlockIndexing.cc.

IndexType Hammer::MultiDimensional::BlockIndexing::dim ( IndexLabel  label) const

dimension of a specific component by label.

    If multiple components with the same label exists,
    returns the dimension of first (they should all be the same
    by consistency)
Parameters
[in]labelthe component label
Returns
the dimension

Definition at line 60 of file BlockIndexing.cc.

IndexList Hammer::MultiDimensional::BlockIndexing::dims ( ) const

get the dimensions of all the indices at once

Returns
the list of dimensions

Definition at line 69 of file BlockIndexing.cc.

void Hammer::MultiDimensional::BlockIndexing::flipLabels ( )

Definition at line 211 of file BlockIndexing.cc.

IndexPair Hammer::MultiDimensional::BlockIndexing::getElementIndex ( IndexType  position) const

Definition at line 169 of file BlockIndexing.cc.

IndexPairList Hammer::MultiDimensional::BlockIndexing::getOppositeLabelPairs ( const UniqueLabelsList indices) const

returns the position of the indices that can be traced together, given a set of allowed index labels

Parameters
[in]indicesthe list of labels of the allowed indices to be traced
Returns
pairs of coordinate indices that needs to be traced together

Definition at line 140 of file BlockIndexing.cc.

IndexPairList Hammer::MultiDimensional::BlockIndexing::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 together, given a set of allowed index labels

Parameters
[in]otherLabelsthe list of labels of the other tensor
[in]indicesthe list of labels of the allowed indices to be contracted
[in]sortedBySecondwhether the result should be sorted according to the second element of the pair
Returns
pairs of indices corresponding to coordinates in this and other tensor that needs to be contracted together

Definition at line 129 of file BlockIndexing.cc.

const LabeledIndexing< AlignedIndexing > & Hammer::MultiDimensional::BlockIndexing::getSubIndexing ( IndexType  position) const

Definition at line 175 of file BlockIndexing.cc.

bool Hammer::MultiDimensional::BlockIndexing::isSameLabelShape ( const LabelsList otherLabels,
const IndexList otherIndices 
) const

Definition at line 148 of file BlockIndexing.cc.

template<typename S >
bool Hammer::MultiDimensional::BlockIndexing::isSameLabelShape ( const LabeledIndexing< S > &  other) const

Definition at line 199 of file BlockIndexing.hh.

bool Hammer::MultiDimensional::BlockIndexing::isSameLabelShape ( const BlockIndexing other,
bool  includeBlockShapes = false 
) const

Definition at line 152 of file BlockIndexing.cc.

IndexType Hammer::MultiDimensional::BlockIndexing::labelIndex ( IndexLabel  label) const

Definition at line 144 of file BlockIndexing.cc.

LabelsList Hammer::MultiDimensional::BlockIndexing::labels ( ) const

get the labels of all the indices at once

Returns
the list of labels

Definition at line 73 of file BlockIndexing.cc.

size_t Hammer::MultiDimensional::BlockIndexing::maxSubRank ( ) const

Definition at line 134 of file BlockIndexing.cc.

size_t Hammer::MultiDimensional::BlockIndexing::numSubIndexing ( ) const

Definition at line 179 of file BlockIndexing.cc.

PositionType Hammer::MultiDimensional::BlockIndexing::numValues ( ) const

the number of elements (product of all the dimensions)

Definition at line 81 of file BlockIndexing.cc.

BlockIndexing& Hammer::MultiDimensional::BlockIndexing::operator= ( const BlockIndexing )
default
BlockIndexing& Hammer::MultiDimensional::BlockIndexing::operator= ( BlockIndexing &&  )
default
vector< tuple< IndexList, vector< bool >, PositionType > > Hammer::MultiDimensional::BlockIndexing::processShifts ( const DotGroupList chunks,
IndexPairMember  which 
) const

Definition at line 218 of file BlockIndexing.cc.

size_t Hammer::MultiDimensional::BlockIndexing::rank ( ) const

rank of the tensor

Returns
the number of components

Definition at line 46 of file BlockIndexing.cc.

UniqueLabelsList Hammer::MultiDimensional::BlockIndexing::spinIndices ( ) const

returns only the labels corresponding to spin indices

Returns
the set of labels of the spin indices (squashes repetitions if present)

Definition at line 77 of file BlockIndexing.cc.

vector< IndexList > Hammer::MultiDimensional::BlockIndexing::splitIndices ( const IndexList indices) const

Definition at line 103 of file BlockIndexing.cc.

vector< IndexList::const_iterator > Hammer::MultiDimensional::BlockIndexing::splitIndices ( IndexList::const_iterator  first,
IndexList::const_iterator  last 
) const

Definition at line 116 of file BlockIndexing.cc.

PositionType Hammer::MultiDimensional::BlockIndexing::splitPosition ( const OuterElemIterator currentPosition,
const DotGroupType chunk,
const IndexList outerShiftsInnerPositions,
const std::vector< bool > &  isOuter,
IndexList innerList,
std::vector< bool > &  innerAdded,
bool  shouldCompare = false 
) const

Definition at line 259 of file BlockIndexing.cc.

Member Data Documentation

LabeledIndexing<AlignedIndexing> Hammer::MultiDimensional::BlockIndexing::_globalIndexing
private

Definition at line 194 of file BlockIndexing.hh.

std::vector<IndexType> Hammer::MultiDimensional::BlockIndexing::_splitIndices
private

Definition at line 192 of file BlockIndexing.hh.

std::vector<PositionType> Hammer::MultiDimensional::BlockIndexing::_splitPads
private

Definition at line 193 of file BlockIndexing.hh.

std::vector<LabeledIndexing<AlignedIndexing> > Hammer::MultiDimensional::BlockIndexing::_subIndexing
private

Definition at line 191 of file BlockIndexing.hh.


The documentation for this class was generated from the following files: