25 namespace MultiDimensional {
27 using VTensor = VectorContainer;
28 using STensor = SparseContainer;
30 using Base = IContainer;
37 for(; ita != a.
end(); ++itb, ++ita) {
44 auto first1 = a.
begin();
45 auto first2 = b.
begin();
46 while (first1 != a.
end()) {
47 if (first2 == b.
end())
49 if (first1->first < first2->first) {
50 first1->second =
isZero(first1->second) ? 0.: numeric_limits<double>::infinity();
53 if (!(first2->first < first1->first)) {
54 first1->second /= first2->second;
66 auto first2 = b.
begin();
68 if (first2 == b.
end()) {
69 for (
size_t m = n; m < oldsize; ++m) {
70 a[m] =
isZero(a[m]) ? 0. : numeric_limits<double>::infinity();
74 if (n < b.
getIndexing().alignedPosToPos(first2->first)) {
75 a[n] =
isZero(a[n]) ? 0. : numeric_limits<double>::infinity();
78 if (!(b.
getIndexing().alignedPosToPos(first2->first) < n)) {
79 a[n] /= first2->second;
89 for (
auto& elem : a) {
90 elem.second /= b[a.getIndexing().alignedPosToPos(elem.first)];
108 throw Error(
"Invalid data types for tensor Divide");
DataType::const_iterator const_iterator
const LabeledIndexing< AlignedIndexing > & getIndexing() const
DataType::iterator iterator
Non-sparse tensor data container.
(Sum of) Outer product tensor data container
Hammer exception definitions.
size_t numValues() const override
Sparse tensor data container.
virtual IndexList dims() const =0
bool isZero(const std::complex< double > val)
iterator erase(const_iterator first, const_iterator last)
Tensor element-wise division algorithm.
Generic tensor indexing iterator.
virtual reference element(const IndexList &coords={})=0