fix typos and formal stuff -> tests work again
This commit is contained in:
parent
451d58c037
commit
8f94517aa4
3 changed files with 29 additions and 40 deletions
|
@ -21,12 +21,12 @@ namespace MultiArrayTools
|
||||||
class MultiArray;
|
class MultiArray;
|
||||||
|
|
||||||
// multi_array_operation.h
|
// multi_array_operation.h
|
||||||
template <typename T>
|
template <typename T, class OperationClass>
|
||||||
class OperationBase;
|
class OperationBase;
|
||||||
|
|
||||||
// multi_array_operation.h
|
// multi_array_operation.h
|
||||||
template <typename T>
|
//template <typename T>
|
||||||
class MutableOperationBase;
|
//class MutableOperationBase;
|
||||||
|
|
||||||
// multi_array_operation.h
|
// multi_array_operation.h
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
|
|
|
@ -55,14 +55,20 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend OperationClass;
|
friend OperationClass;
|
||||||
OperationTemplate() = default;
|
friend OperationTemplate<T,OperationClass>;
|
||||||
|
OperationBase() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
class OperationTemplate : public OperationBase<T,OperationClass>
|
class OperationTemplate : public OperationBase<T,OperationClass>
|
||||||
{ /* empty per default; specialize if needed */ };
|
{
|
||||||
|
/* empty per default; specialize if needed */
|
||||||
|
private:
|
||||||
|
OperationTemplate() = default;
|
||||||
|
friend OperationClass;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#include "type_operations.h"
|
|
||||||
|
|
||||||
template <typename T, class OpClass, class... Ranges>
|
template <typename T, class OpClass, class... Ranges>
|
||||||
class OperationMaster
|
class OperationMaster
|
||||||
|
@ -96,7 +102,7 @@ namespace MultiArrayTools
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef OperationBase<T> OB;
|
//typedef OperationBase<T> OB;
|
||||||
typedef ContainerRange<T,Ranges...> CRange;
|
typedef ContainerRange<T,Ranges...> CRange;
|
||||||
typedef ContainerIndex<T,typename Ranges::IndexType...> IndexType;
|
typedef ContainerIndex<T,typename Ranges::IndexType...> IndexType;
|
||||||
//typedef typename MultiRange<Ranges...>::IndexType IndexType;
|
//typedef typename MultiRange<Ranges...>::IndexType IndexType;
|
||||||
|
@ -301,29 +307,6 @@ namespace MultiArrayTools
|
||||||
auto loop(Expr exp) const -> decltype(mInd->iforh(exp));
|
auto loop(Expr exp) const -> decltype(mInd->iforh(exp));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
|
||||||
struct operate
|
|
||||||
{
|
|
||||||
static inline OperationRoot<T,Ranges...>
|
|
||||||
apply(const MultiArrayBase<T,Ranges...>& ma,
|
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices)
|
|
||||||
{
|
|
||||||
return OperationRoot<T,Ranges...>(ma, indices...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// interchange inheritance
|
|
||||||
// try to implement the 'promote' version
|
|
||||||
template <class OperationClass, typename T, class... Ranges>
|
|
||||||
class TypeSpecificOperationSet<MultiArray<T,Ranges...>,OperationClass>
|
|
||||||
{
|
|
||||||
auto operator()() const
|
|
||||||
-> Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>
|
|
||||||
{
|
|
||||||
return Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>
|
|
||||||
(/*THIS*/);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================= *
|
/* ========================= *
|
||||||
|
@ -343,7 +326,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
template <class Second>
|
template <class Second>
|
||||||
auto OperationTemplate<T,OperationClass>::operator+(const Second& in) const
|
auto OperationBase<T,OperationClass>::operator+(const Second& in) const
|
||||||
-> Operation<T,plus<T>,OperationClass,Second>
|
-> Operation<T,plus<T>,OperationClass,Second>
|
||||||
{
|
{
|
||||||
return Operation<T,plus<T>,OperationClass,Second>(THIS(), in);
|
return Operation<T,plus<T>,OperationClass,Second>(THIS(), in);
|
||||||
|
@ -351,7 +334,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
template <class Second>
|
template <class Second>
|
||||||
auto OperationTemplate<T,OperationClass>::operator-(const Second& in) const
|
auto OperationBase<T,OperationClass>::operator-(const Second& in) const
|
||||||
-> Operation<T,minus<T>,OperationClass,Second>
|
-> Operation<T,minus<T>,OperationClass,Second>
|
||||||
{
|
{
|
||||||
return Operation<T,minus<T>,OperationClass,Second>(THIS(), in);
|
return Operation<T,minus<T>,OperationClass,Second>(THIS(), in);
|
||||||
|
@ -359,7 +342,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
template <class Second>
|
template <class Second>
|
||||||
auto OperationTemplate<T,OperationClass>::operator*(const Second& in) const
|
auto OperationBase<T,OperationClass>::operator*(const Second& in) const
|
||||||
-> Operation<T,multiplies<T>,OperationClass,Second>
|
-> Operation<T,multiplies<T>,OperationClass,Second>
|
||||||
{
|
{
|
||||||
return Operation<T,multiplies<T>,OperationClass,Second>(THIS(), in);
|
return Operation<T,multiplies<T>,OperationClass,Second>(THIS(), in);
|
||||||
|
@ -367,7 +350,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
template <class Second>
|
template <class Second>
|
||||||
auto OperationTemplate<T,OperationClass>::operator/(const Second& in) const
|
auto OperationBase<T,OperationClass>::operator/(const Second& in) const
|
||||||
-> Operation<T,divides<T>,OperationClass,Second>
|
-> Operation<T,divides<T>,OperationClass,Second>
|
||||||
{
|
{
|
||||||
return Operation<T,divides<T>,OperationClass,Second>(THIS(), in);
|
return Operation<T,divides<T>,OperationClass,Second>(THIS(), in);
|
||||||
|
@ -375,7 +358,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class OperationClass>
|
template <typename T, class OperationClass>
|
||||||
template <class IndexType>
|
template <class IndexType>
|
||||||
auto OperationTemplate<T,OperationClass>::c(std::shared_ptr<IndexType>& ind) const
|
auto OperationBase<T,OperationClass>::c(std::shared_ptr<IndexType>& ind) const
|
||||||
-> Contraction<T,OperationClass,IndexType>
|
-> Contraction<T,OperationClass,IndexType>
|
||||||
{
|
{
|
||||||
return Contraction<T,OperationClass,IndexType>(THIS(), ind);
|
return Contraction<T,OperationClass,IndexType>(THIS(), ind);
|
||||||
|
@ -620,4 +603,6 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "type_operations.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,20 +34,24 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
// this is, why non-static
|
// this is, why non-static
|
||||||
std::tuple<std::shared_ptr<typename Ranges::IndexType>...> ituple;
|
std::tuple<std::shared_ptr<typename Ranges::IndexType>...> ituple;
|
||||||
}
|
};
|
||||||
|
|
||||||
template <class OperationClass, typename T, class... Ranges>
|
template <class OperationClass, typename T, class... Ranges>
|
||||||
class OperationTemplate : public OperationBase<MultiArray<T,Ranges...>,OperationClass>
|
class OperationTemplate<MultiArray<T,Ranges...>,OperationClass> : public OperationBase<MultiArray<T,Ranges...>,OperationClass>
|
||||||
{
|
{
|
||||||
typedef OperationBase<MultiArray<T,Ranges...>,OperationClass> OB;
|
typedef OperationBase<MultiArray<T,Ranges...>,OperationClass> OB;
|
||||||
|
|
||||||
auto operator()(const std::shared_ptr<typename Ranges::IndexType>&... indices)
|
auto operator()(const std::shared_ptr<typename Ranges::IndexType>&... indices)
|
||||||
-> Operation<OperationRoot<T,Ranges...>,operate,OperationClass>
|
-> Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>
|
||||||
{
|
{
|
||||||
std::shared_ptr<operate> ff(indices...);
|
std::shared_ptr<operate<T,Ranges...> > ff(indices...);
|
||||||
return Operation(ff, OB::THIS());
|
return Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>(ff, OB::THIS());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OperationTemplate() = default;
|
||||||
|
friend OperationClass;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue