minor change

This commit is contained in:
Christian Zimmermann 2020-08-30 01:35:06 +02:00
parent 566da70618
commit 7e963c1c95
3 changed files with 29 additions and 14 deletions

View file

@ -135,7 +135,6 @@ namespace MultiArrayTools
OpH<OperationRoot<T,Ranges...>> DynamicOuterOp<T,Operation,Ranges...>::get(const DExtT& pos) const
{
mL(0,pos.expl<ET>());
// execute assignment... care about threads!!!
return mProto; // empty
}
@ -172,12 +171,4 @@ namespace MultiArrayTools
return std::make_shared<DynamicOuterOp<T,Operation,Ranges...>>(*this);
}
template <class Operation, class... Indices>
DynamicOuterOp<typename Operation::value_type,Operation,typename Indices::RangeType...>
mkDynOutOp(const Operation& op, const std::shared_ptr<Indices>&... inds)
{
return DynamicOuterOp<typename Operation::value_type,Operation,
typename Indices::RangeType...>(op, inds...);
}
} // namespace MultiArrayTools

View file

@ -108,9 +108,6 @@ namespace MultiArrayTools
virtual std::shared_ptr<DynamicOperationBase<OpH<OperationRoot<T,Ranges...>>>> deepCopy() const override final;
};
template <class Operation, class... Indices>
DynamicOuterOp<typename Operation::value_type,Operation,typename Indices::RangeType...>
mkDynOutOp(const Operation& op, const std::shared_ptr<Indices>&... inds);
template <typename T>
class DynamicO : public OperationTemplate<T,DynamicO<T>>
@ -146,6 +143,23 @@ namespace MultiArrayTools
inline const T* data() const { return mOp->data(); }
};
template <class Operation, class... Indices>
auto mkDynOutOp(const Operation& op, const std::shared_ptr<Indices>&... inds)
{
return DynamicO<OpH<OperationRoot<typename Operation::value_type,
typename Indices::RangeType...>>>
(DynamicOuterOp<typename Operation::value_type,Operation,
typename Indices::RangeType...>(op, inds...));
}
// Build plan
/*
template <class Operation>
class OperationBuilder
{
};
*/
} // namespace MultiArrayTools
#endif

View file

@ -60,6 +60,7 @@ namespace
std::shared_ptr<DR> dr4a;
std::shared_ptr<DR> dr5;
std::shared_ptr<DR> dr6;
std::shared_ptr<DR> dr6a;
std::shared_ptr<CR> cr1;
std::shared_ptr<CR::IndexType> ci4_1;
@ -80,6 +81,7 @@ namespace
dr3 = createRangeE<DR>(cr2,cr5);
dr5 = createRangeE<DR>(cr5);
dr6 = createRangeE<DR>(cr3,cr4);
dr6a = createRangeE<DR>(cr3);
dr4 = createRangeE<DR>(cr2,cr3,cr4,cr4);
dr4a = createRangeE<DR>(cr2,cr3);
@ -192,20 +194,28 @@ namespace
auto di3 = getIndex(dr3);
auto di5 = getIndex(dr5);
auto di6 = getIndex(dr6);
//auto di6a = getIndex(dr6a);
(*di1)({imap["i2_1"],imap["i2_1"],imap["i3_1"],imap["i4_1"]});
(*di3)({imap["i2_1"],imap["i5_1"]});
(*di5)({imap["i5_1"]});
(*di6)({imap["i3_1"],imap["i4_1"]});
//(*di6a)({imap["i3_1"]});
auto resx1 = res2;
auto resx2 = res2;
auto resx3 = res2;
//auto resx4 = res2;
res2(i1,di6) += (ma1(i1,di1) * ma5(di5)).c(di3);
resx1(i1,di6) += (mkDynOp(ma1(i1,di1)) * mkDynOp(ma5(di5))).c(di3);
resx2(i1,di6) += mkDynOp((ma1(i1,di1) * ma5(di5)).c(di3));
resx3(i1,di6) += mkDynOp((mkDynOp(ma1(i1,di1)) * mkDynOp(ma5(di5))).c(di3));
//auto op1 = mkDynOutOp(ma1(i1,di1) * ma5(di5), ci4_1);
//resx2(i1,di6) += mkDynOp((ma1(i1,di1) * ma5(di5)).c(di3));
auto i2_1 = imap.at("i2_1");
auto i3_1 = imap.at("i3_1");
auto i4_1 = imap.at("i4_1");