ma operation: parallel version of .to and .addto
This commit is contained in:
parent
a8efbd083a
commit
472abec3fd
2 changed files with 29 additions and 0 deletions
|
@ -108,6 +108,27 @@ namespace MultiArrayTools
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, class OperationClass>
|
||||||
|
template <class... Indices>
|
||||||
|
auto OperationBase<T,OperationClass>::pto(const std::shared_ptr<Indices>&... inds) const
|
||||||
|
-> MultiArray<T,typename Indices::RangeType...>
|
||||||
|
{
|
||||||
|
MultiArray<T,typename Indices::RangeType...> out(inds->range()...);
|
||||||
|
out(inds...).par() = THIS();
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, class OperationClass>
|
||||||
|
template <class... Indices>
|
||||||
|
auto OperationBase<T,OperationClass>::paddto(const std::shared_ptr<Indices>&... inds) const
|
||||||
|
-> MultiArray<T,typename Indices::RangeType...>
|
||||||
|
{
|
||||||
|
MultiArray<T,typename Indices::RangeType...> out(inds->range()...,
|
||||||
|
static_cast<T>(0));
|
||||||
|
out(inds...).par() += THIS();
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
template <typename R, class... Args>
|
template <typename R, class... Args>
|
||||||
auto OperationBase<T,OperationClass>::a(const std::shared_ptr<function<R,T,typename Args::value_type...>>& ll,
|
auto OperationBase<T,OperationClass>::a(const std::shared_ptr<function<R,T,typename Args::value_type...>>& ll,
|
||||||
|
|
|
@ -73,6 +73,14 @@ namespace MultiArrayTools
|
||||||
auto addto(const std::shared_ptr<Indices>&... inds) const
|
auto addto(const std::shared_ptr<Indices>&... inds) const
|
||||||
-> MultiArray<T,typename Indices::RangeType...>;
|
-> MultiArray<T,typename Indices::RangeType...>;
|
||||||
|
|
||||||
|
template <class... Indices>
|
||||||
|
auto pto(const std::shared_ptr<Indices>&... inds) const
|
||||||
|
-> MultiArray<T,typename Indices::RangeType...>;
|
||||||
|
|
||||||
|
template <class... Indices>
|
||||||
|
auto paddto(const std::shared_ptr<Indices>&... inds) const
|
||||||
|
-> MultiArray<T,typename Indices::RangeType...>;
|
||||||
|
|
||||||
template <typename R, class... Args> // Args = Operation Classes
|
template <typename R, class... Args> // Args = Operation Classes
|
||||||
auto a(const std::shared_ptr<function<R,T,typename Args::value_type...>>& ll, const Args&... args) const
|
auto a(const std::shared_ptr<function<R,T,typename Args::value_type...>>& ll, const Args&... args) const
|
||||||
-> Operation<R,function<R,T,typename Args::value_type...>,OperationClass, Args...>;
|
-> Operation<R,function<R,T,typename Args::value_type...>,OperationClass, Args...>;
|
||||||
|
|
Loading…
Reference in a new issue