From 8b23a173da604cff29b7f15f1c64b7d4664feafc Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Thu, 2 Nov 2017 21:20:31 +0100 Subject: [PATCH] im com --- src/multi_array_operation.cc | 9 +++++++++ src/multi_array_operation.h | 14 +++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/multi_array_operation.cc b/src/multi_array_operation.cc index 84ccfa5..9d4d275 100644 --- a/src/multi_array_operation.cc +++ b/src/multi_array_operation.cc @@ -161,6 +161,15 @@ namespace MultiArrayTools return Operation,OperationClass,Second>(*mOc, in); } + template + template + auto OperationTemplate::c(std::shared_ptr& ind) const + -> Contraction + { + return Contraction(*mOc, ind); + } + + /************************* * OperationMaster * *************************/ diff --git a/src/multi_array_operation.h b/src/multi_array_operation.h index 7f3db9c..6fa7a48 100644 --- a/src/multi_array_operation.h +++ b/src/multi_array_operation.h @@ -108,6 +108,10 @@ namespace MultiArrayTools template auto operator/(const Second& in) const -> Operation,OperationClass,Second>; + + template + auto c(std::shared_ptr& ind) const + -> Contraction; private: OperationClass* mOc; @@ -223,15 +227,15 @@ namespace MultiArrayTools mutable BlockResult mRes; }; - template + template class Contraction : public OperationTemplate > { public: typedef T value_type; - typedef OperationTemplate > OT; - - Contraction(const Op& op); + typedef OperationTemplate > OT; + + Contraction(const Op& op, std::shared_ptr ind); const BlockResult& get() const; @@ -241,8 +245,8 @@ namespace MultiArrayTools protected: const Op& mOp; + std::shared_ptr mInd; mutable BlockResult mRes; - }; }