adds to last commit
This commit is contained in:
parent
529ae3353e
commit
9d7ab24d8c
7 changed files with 44 additions and 11 deletions
|
@ -439,11 +439,16 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
#ifdef XX_USE_NEW_LOOP_ROUTINE_XX
|
#ifdef XX_USE_NEW_LOOP_ROUTINE_XX
|
||||||
// === N E W ===
|
// === N E W ===
|
||||||
AssignmentExpr ae(this, &mSecond);
|
static const size_t TDIM = IndexType::totalDim()
|
||||||
|
typedef std::array<std::intptr_t,TDIM> IAT;
|
||||||
typedef decltype(mSecond.rootSteps()) RootStepType;
|
typedef decltype(mSecond.rootSteps()) RootStepType;
|
||||||
std::array<RootStepType,/*sizeof single indices!!*/>
|
|
||||||
ee(PackNum</*sizeof single indices!!*/-1>::mkExt(mIndex, mSecond));
|
AssignmentExpr ae(this, &mSecond);
|
||||||
static auto loop = mIndex->ifor(ee, ae);
|
|
||||||
|
IAT siar = mIndex->getSIndexTuple();
|
||||||
|
std::array<RootStepType,TDIM> ee;
|
||||||
|
PackNum<TDIM-1>::mkExt(ee, siar, mSecond);
|
||||||
|
auto loop = mIndex->ifor(ee, ae);
|
||||||
loop();
|
loop();
|
||||||
#else
|
#else
|
||||||
// === O L D ===
|
// === O L D ===
|
||||||
|
|
|
@ -56,12 +56,15 @@ namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
return std::tuple_cat( PackNum<N-1>::mkStepTuple(ii, otp), std::get<N>(otp).rootSteps(ii) );
|
return std::tuple_cat( PackNum<N-1>::mkStepTuple(ii, otp), std::get<N>(otp).rootSteps(ii) );
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
template <class IndexClass, class OpClass>
|
template <class RootStepTuple, class IndexClass, class OpClass>
|
||||||
static auto mkExt(const std::shared_ptr<IndexClass>& idxPtr, const OpClass& second)
|
static void mkExt(std::array<RootStepTuple,IndexClass::totalDim()>& out,
|
||||||
|
const std::array<std::intptr_t,IndexClass::totalDim()>& siar,
|
||||||
|
const OpClass& second)
|
||||||
{
|
{
|
||||||
// !!!!!
|
std::get<N>(out) = second.rootSteps( std::get<N>(siar) );
|
||||||
}*/
|
PackNum<N-1>::mkExt(out, siar, second);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
@ -108,6 +111,14 @@ namespace MultiArrayHelper
|
||||||
return std::get<0>(otp).rootSteps(ii);
|
return std::get<0>(otp).rootSteps(ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class RootStepTuple, class IndexClass, class OpClass>
|
||||||
|
static void mkExt(std::array<RootStepTuple,IndexClass::totalDim()>& out,
|
||||||
|
const std::array<std::intptr_t,IndexClass::totalDim()>& siar,
|
||||||
|
const OpClass& second)
|
||||||
|
{
|
||||||
|
std::get<0>(out) = second.rootSteps( std::get<0>(siar) );
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
static IndexType sType() { return IndexType::CONT; }
|
static IndexType sType() { return IndexType::CONT; }
|
||||||
static size_t sDim() { return sizeof...(Indices); }
|
static size_t sDim() { return sizeof...(Indices); }
|
||||||
|
static size_t totalDim() { return mkTotalDim<Indices...>(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
static IndexType sType() { return IndexType::MULTI; }
|
static IndexType sType() { return IndexType::MULTI; }
|
||||||
static size_t sDim() { return sizeof...(Indices); }
|
static size_t sDim() { return sizeof...(Indices); }
|
||||||
|
static size_t totalDim() { return mkTotalDim<Indices...>(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,20 @@ namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
using namespace MultiArrayTools;
|
using namespace MultiArrayTools;
|
||||||
|
|
||||||
|
|
||||||
|
template <class Index1>
|
||||||
|
size_t mkTotalDim()
|
||||||
|
{
|
||||||
|
return typename Index1::totalDim();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Index1, class Index2, class... Indices>
|
||||||
|
size_t mkTotalDim()
|
||||||
|
{
|
||||||
|
return typename Index1::totalDim() * mkTotalDim<Index2,Indices...>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
struct RPackNum
|
struct RPackNum
|
||||||
{
|
{
|
||||||
|
@ -227,7 +241,7 @@ namespace MultiArrayHelper
|
||||||
return std::get<std::tuple_size<IndexPack>::value-N>(ipack)
|
return std::get<std::tuple_size<IndexPack>::value-N>(ipack)
|
||||||
->ifor( ext, RPackNum<N-1>::mkFor(ipack, ext, exs) );
|
->ifor( ext, RPackNum<N-1>::mkFor(ipack, ext, exs) );
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace MultiArrayTools
|
||||||
SingleIndex(const std::shared_ptr<SingleRange<U,TYPE> >& range);
|
SingleIndex(const std::shared_ptr<SingleRange<U,TYPE> >& range);
|
||||||
|
|
||||||
static IndexType sType() { return IndexType::SINGLE; }
|
static IndexType sType() { return IndexType::SINGLE; }
|
||||||
|
static size_t totalDim() { return 1; }
|
||||||
|
|
||||||
// ==== >>>>> STATIC POLYMORPHISM <<<<< ====
|
// ==== >>>>> STATIC POLYMORPHISM <<<<< ====
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace MultiArrayHelper
|
||||||
std::tuple<to_size_t<Ops>...>&& ext,
|
std::tuple<to_size_t<Ops>...>&& ext,
|
||||||
const Args&... args) :
|
const Args&... args) :
|
||||||
mIndPtr(indPtr), mExpr(args...), mExt(ext) {}
|
mIndPtr(indPtr), mExpr(args...), mExt(ext) {}
|
||||||
|
|
||||||
template <class IndexClass, class Expr, class... Ops>
|
template <class IndexClass, class Expr, class... Ops>
|
||||||
For<IndexClass,Expr,Ops...>::For(IndexClass* indPtr,
|
For<IndexClass,Expr,Ops...>::For(IndexClass* indPtr,
|
||||||
Expr&& expr, std::tuple<to_size_t<Ops>...>&& ext) :
|
Expr&& expr, std::tuple<to_size_t<Ops>...>&& ext) :
|
||||||
|
|
Loading…
Reference in a new issue