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; - }; }