From 7e963c1c95447801936d202cfd9cb4215be75ea4 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Sun, 30 Aug 2020 01:35:06 +0200 Subject: [PATCH] minor change --- src/include/dynamic_operation.cc.h | 9 --------- src/include/dynamic_operation.h | 22 ++++++++++++++++++---- src/tests/op4_unit_test.cc | 12 +++++++++++- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/include/dynamic_operation.cc.h b/src/include/dynamic_operation.cc.h index dd67193..630986f 100644 --- a/src/include/dynamic_operation.cc.h +++ b/src/include/dynamic_operation.cc.h @@ -135,7 +135,6 @@ namespace MultiArrayTools OpH> DynamicOuterOp::get(const DExtT& pos) const { mL(0,pos.expl()); - // execute assignment... care about threads!!! return mProto; // empty } @@ -172,12 +171,4 @@ namespace MultiArrayTools return std::make_shared>(*this); } - template - DynamicOuterOp - mkDynOutOp(const Operation& op, const std::shared_ptr&... inds) - { - return DynamicOuterOp(op, inds...); - } - } // namespace MultiArrayTools diff --git a/src/include/dynamic_operation.h b/src/include/dynamic_operation.h index df69871..1dff713 100644 --- a/src/include/dynamic_operation.h +++ b/src/include/dynamic_operation.h @@ -108,9 +108,6 @@ namespace MultiArrayTools virtual std::shared_ptr>>> deepCopy() const override final; }; - template - DynamicOuterOp - mkDynOutOp(const Operation& op, const std::shared_ptr&... inds); template class DynamicO : public OperationTemplate> @@ -145,7 +142,24 @@ namespace MultiArrayTools inline DynamicExpression loop(const DynamicExpression& exp) const { return mOp->loop(exp); } inline const T* data() const { return mOp->data(); } }; - + + template + auto mkDynOutOp(const Operation& op, const std::shared_ptr&... inds) + { + return DynamicO>> + (DynamicOuterOp(op, inds...)); + } + + // Build plan + /* + template + class OperationBuilder + { + + }; + */ } // namespace MultiArrayTools #endif diff --git a/src/tests/op4_unit_test.cc b/src/tests/op4_unit_test.cc index 9db2bbd..93a1194 100644 --- a/src/tests/op4_unit_test.cc +++ b/src/tests/op4_unit_test.cc @@ -60,6 +60,7 @@ namespace std::shared_ptr dr4a; std::shared_ptr dr5; std::shared_ptr dr6; + std::shared_ptr dr6a; std::shared_ptr cr1; std::shared_ptr ci4_1; @@ -80,6 +81,7 @@ namespace dr3 = createRangeE(cr2,cr5); dr5 = createRangeE(cr5); dr6 = createRangeE(cr3,cr4); + dr6a = createRangeE(cr3); dr4 = createRangeE(cr2,cr3,cr4,cr4); dr4a = createRangeE(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");