12 #ifndef HAMMER_MATH_MULTIDIM_SPARSECONTAINER
13 #define HAMMER_MATH_MULTIDIM_SPARSECONTAINER
19 #include <type_traits>
33 struct FBSingleTensor;
37 namespace MultiDimensional {
53 using DataType = std::map<PositionType, ElementType>;
61 ElementType value(IndexList::const_iterator first, IndexList::const_iterator last)
const;
80 size_t rank()
const override;
103 void clear()
override;
110 SerialType write(flatbuffers::FlatBufferBuilder* msgwriter)
const override;
128 void next(
int n = 1)
override;
135 DataType::const_iterator
_it;
size_t entrySize() const override
NonZeroIt endNonZero() const override
Log & getLog() const
logging facility
TensorData makeEmptySparse(const IndexList &dimensions, const LabelsList &labels)
std::pair< flatbuffers::Offset< void >, Serial::FBTensorTypes > SerialType
bool compare(const IContainer &other) const override
std::unique_ptr< ItBase > NonZeroIt
const LabeledIndexing< AlignedIndexing > & getIndexing() const
SerialType write(flatbuffers::FlatBufferBuilder *msgwriter) const override
std::map< PositionType, ElementType > DataType
std::vector< IndexPair > IndexPairList
IContainer & conjugate() override
size_t numValues() const override
NonZeroIt firstNonZero() const override
IndexList dims() const override
std::complex< double > ElementType
ItAligned(DataType::const_iterator it)
IndexPairList getSameLabelPairs(const IContainer &other, const UniqueLabelsList &indices) const override
std::unique_ptr< IContainer > TensorData
IContainer::ElementType value() const override
LabeledIndexing< AlignedIndexing > _indexing
void next(int n=1) override
std::vector< IndexType > IndexList
DataType::const_iterator const_iterator
ElementType value(const IndexList &indices) const
TensorData clone() const override
bool canAddAt(const IContainer &subContainer, IndexLabel coord, IndexType position) const override
IndexLabel
label identifiers of tensor indices they are used to determine which indices can be contracted togeth...
Interface class for single container data structure.
PositionType position() const override
size_t rank() const override
ptrdiff_t distanceFrom(const ItBase &other) const override
std::vector< IndexLabel > LabelsList
std::set< IndexLabel > UniqueLabelsList
iterator erase(const_iterator first, const_iterator last)
bool isSame(const ItBase &other) const override
LabelsList labels() const override
IndexType labelToIndex(IndexLabel label) const override
DataType::const_iterator _it
size_t dataSize() const override
void setValue(const IndexList &indices, ElementType value=0.)
DataType::iterator iterator
IndexPairList getSpinLabelPairs() const override
IContainer & operator*=(double value) override
bool isAligned() const override
reference operator[](PositionType pos)
bool isSameShape(const IContainer &other) const override
SparseContainer(const IndexList &dimensions, const LabelsList &labels)
reference element(const IndexList &coords={}) override