28 namespace MultiDimensional {
30 using VTensor = VectorContainer;
31 using STensor = SparseContainer;
33 using Base = IContainer;
40 for(; ita != a.
end(); ++itb, ++ita) {
47 for (
auto& elem : b) {
48 a[elem.first] += elem.second;
54 for (
auto& elem : b) {
55 a[b.getIndexing().alignedPosToPos(elem.first)] += elem.second;
62 auto result = this->operator()(*tmp, a);
75 if(numTerms % 10 == 0) {
78 return (*
this)(*sparse, b);
83 for (
auto& elem : tmp._data) {
91 auto result = this->operator()(*tmp, a);
97 auto result = this->operator()(*tmp, a);
106 auto res = b.
clone();
107 return res.release();
110 iota(chunkIndices.begin(),chunkIndices.end(),0);
115 a[b.getIndexing().buildFullPosition(bi, chunkIndices)] += *bi;
124 for (
auto elem : bf) {
131 throw Error(
"Invalid data types for tensor sum");
size_t numAddends() const
bool shouldBeEvaluated() const
DataType::const_iterator const_iterator
DataType::iterator iterator
Non-sparse tensor data container.
void reserve(size_t numTerms)
TensorData clone() const override
(Sum of) Outer product tensor data container
Hammer exception definitions.
OuterElemIterator end() const
Sparse tensor data container.
std::vector< IndexType > IndexList
virtual IndexList dims() const =0
void addTerm(std::vector< std::pair< SharedTensorData, bool >> tensorsAndConjFlags)
Generic tensor indexing iterator.
size_t dataSize() const override
Tensor storage type conversion algorithm.
virtual reference element(const IndexList &coords={})=0