This commit is contained in:
Christian Zimmermann 2017-11-02 21:20:31 +01:00
parent 14bf7d003c
commit 8b23a173da
2 changed files with 18 additions and 5 deletions

View file

@ -161,6 +161,15 @@ namespace MultiArrayTools
return Operation<T,std::divides<T>,OperationClass,Second>(*mOc, in); return Operation<T,std::divides<T>,OperationClass,Second>(*mOc, in);
} }
template <typename T, class OperationClass>
template <class IndexType>
auto OperationTemplate<T,OperationClass>::c(std::shared_ptr<IndexType>& ind) const
-> Contraction<T,OperationClass,IndexType>
{
return Contraction<T,OperationClass,IndexType>(*mOc, ind);
}
/************************* /*************************
* OperationMaster * * OperationMaster *
*************************/ *************************/

View file

@ -109,6 +109,10 @@ namespace MultiArrayTools
auto operator/(const Second& in) const auto operator/(const Second& in) const
-> Operation<T,std::divides<T>,OperationClass,Second>; -> Operation<T,std::divides<T>,OperationClass,Second>;
template <class IndexType>
auto c(std::shared_ptr<IndexType>& ind) const
-> Contraction<T,OperationClass,IndexType>;
private: private:
OperationClass* mOc; OperationClass* mOc;
}; };
@ -223,15 +227,15 @@ namespace MultiArrayTools
mutable BlockResult<T> mRes; mutable BlockResult<T> mRes;
}; };
template <typename T, class Op> template <typename T, class Op, class IndexType>
class Contraction : public OperationTemplate<T,Contraction<T,Op> > class Contraction : public OperationTemplate<T,Contraction<T,Op> >
{ {
public: public:
typedef T value_type; typedef T value_type;
typedef OperationTemplate<T,Contraction<T,Op> > OT; typedef OperationTemplate<T,Contraction<T,Op,IndexType> > OT;
Contraction(const Op& op); Contraction(const Op& op, std::shared_ptr<IndexType> ind);
const BlockResult<T>& get() const; const BlockResult<T>& get() const;
@ -241,8 +245,8 @@ namespace MultiArrayTools
protected: protected:
const Op& mOp; const Op& mOp;
std::shared_ptr<IndexType> mInd;
mutable BlockResult<T> mRes; mutable BlockResult<T> mRes;
}; };
} }