fix dynamic expressions
This commit is contained in:
parent
354a275c12
commit
a64291484c
7 changed files with 43 additions and 42 deletions
|
@ -321,10 +321,10 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
MExt<void> ConstOperationRoot<T,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
MExt<None> ConstOperationRoot<T,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
||||||
{
|
{
|
||||||
return MExt<void>(getStepSize( mIndex, iPtrNum ));
|
return MExt<None>(getStepSize( mIndex, iPtrNum ));
|
||||||
//return MExt<void>(getStepSize( getRootIndices( mIndex->info() ), iPtrNum ));
|
//return MExt<None>(getStepSize( getRootIndices( mIndex->info() ), iPtrNum ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -402,10 +402,10 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Range>
|
template <class Range>
|
||||||
MExt<void> MetaOperationRoot<Range>::rootSteps(std::intptr_t iPtrNum) const
|
MExt<None> MetaOperationRoot<Range>::rootSteps(std::intptr_t iPtrNum) const
|
||||||
{
|
{
|
||||||
return MExt<void>(getStepSize( *mIndex, iPtrNum ));
|
return MExt<None>(getStepSize( *mIndex, iPtrNum ));
|
||||||
//return MExt<void>(getStepSize( getRootIndices( mIndex->info() ), iPtrNum ));
|
//return MExt<None>(getStepSize( getRootIndices( mIndex->info() ), iPtrNum ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -544,9 +544,9 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
MExt<void> OperationRoot<T,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
MExt<None> OperationRoot<T,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
||||||
{
|
{
|
||||||
return MExt<void>(getStepSize( mIndex, iPtrNum ));
|
return MExt<None>(getStepSize( mIndex, iPtrNum ));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
|
@ -661,10 +661,10 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
MExt<void> ParallelOperationRoot<T,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
MExt<None> ParallelOperationRoot<T,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
||||||
{
|
{
|
||||||
return MExt<void>(getStepSize( mIndex, iPtrNum ));
|
return MExt<None>(getStepSize( mIndex, iPtrNum ));
|
||||||
//return MExt<void>(getStepSize( mIndex.info(), iPtrNum ));
|
//return MExt<None>(getStepSize( mIndex.info(), iPtrNum ));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
|
|
|
@ -204,7 +204,7 @@ namespace MultiArrayTools
|
||||||
template <class ET>
|
template <class ET>
|
||||||
inline ConstOperationRoot& set(ET pos);
|
inline ConstOperationRoot& set(ET pos);
|
||||||
|
|
||||||
MExt<void> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
MExt<None> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
Expr loop(Expr exp) const;
|
Expr loop(Expr exp) const;
|
||||||
|
@ -278,7 +278,7 @@ namespace MultiArrayTools
|
||||||
template <class ET>
|
template <class ET>
|
||||||
inline MetaOperationRoot& set(ET pos);
|
inline MetaOperationRoot& set(ET pos);
|
||||||
|
|
||||||
MExt<void> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
MExt<None> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
Expr loop(Expr exp) const;
|
Expr loop(Expr exp) const;
|
||||||
|
@ -354,7 +354,7 @@ namespace MultiArrayTools
|
||||||
template <class ET>
|
template <class ET>
|
||||||
inline OperationRoot& set(ET pos);
|
inline OperationRoot& set(ET pos);
|
||||||
|
|
||||||
MExt<void> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
MExt<None> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
Expr loop(Expr exp) const;
|
Expr loop(Expr exp) const;
|
||||||
|
@ -416,7 +416,7 @@ namespace MultiArrayTools
|
||||||
template <class ET>
|
template <class ET>
|
||||||
inline ParallelOperationRoot& set(ET pos);
|
inline ParallelOperationRoot& set(ET pos);
|
||||||
|
|
||||||
MExt<void> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
MExt<None> rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
Expr loop(Expr exp) const;
|
Expr loop(Expr exp) const;
|
||||||
|
|
|
@ -102,34 +102,34 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
ExpressionHolder<Expr> DynamicIndex::ifor(size_t step, Expr ex) const
|
DynamicExpression DynamicIndex::ifor(size_t step, Expr ex) const
|
||||||
{
|
{
|
||||||
if(mIVec.size() == 1){
|
if(mIVec.size() == 1){
|
||||||
return ExpressionHolder<Expr>(mIVec.back().first->ifor(step,ex));
|
return mIVec.back().first->ifor(step,ex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ExpressionHolder<Expr>(ForMaker::mk(mIVec.size()-2, step,
|
return ForMaker::mk(mIVec.size()-2, step,
|
||||||
mIVec.back().first->ifor(step,ex),mIVec));
|
mIVec.back().first->ifor(step,ex),mIVec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
ExpressionHolder<Expr> DynamicIndex::iforh(size_t step, Expr ex) const
|
DynamicExpression DynamicIndex::iforh(size_t step, Expr ex) const
|
||||||
{
|
{
|
||||||
if(mIVec.size() == 1){
|
if(mIVec.size() == 1){
|
||||||
return ExpressionHolder<Expr>(mIVec.back().first->iforh(step,ex));
|
return mIVec.back().first->iforh(step,ex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ExpressionHolder<Expr>(ForMaker::mk(mIVec.size()-2, step,
|
return ForMaker::mk(mIVec.size()-2, step,
|
||||||
mIVec.back().first->iforh(step,ex),
|
mIVec.back().first->iforh(step,ex),
|
||||||
mIVec, true));
|
mIVec, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
ExpressionHolder<Expr> DynamicIndex::pifor(size_t step, Expr ex) const
|
DynamicExpression DynamicIndex::pifor(size_t step, Expr ex) const
|
||||||
{
|
{
|
||||||
return ifor(step, ex); // no multithreading here at the moment...
|
return ifor(step, ex); // no multithreading here at the moment...
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,13 +232,13 @@ namespace MultiArrayTools
|
||||||
void print(size_t offset);
|
void print(size_t offset);
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
ExpressionHolder<Expr> ifor(size_t step, Expr ex) const;
|
DynamicExpression ifor(size_t step, Expr ex) const;
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
ExpressionHolder<Expr> iforh(size_t step, Expr ex) const;
|
DynamicExpression iforh(size_t step, Expr ex) const;
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
ExpressionHolder<Expr> pifor(size_t step, Expr ex) const;
|
DynamicExpression pifor(size_t step, Expr ex) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace MultiArrayHelper
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct SubProp<void>
|
struct SubProp<None>
|
||||||
{
|
{
|
||||||
static constexpr size_t ISSTATIC = 1;
|
static constexpr size_t ISSTATIC = 1;
|
||||||
static constexpr size_t SIZE = 1;
|
static constexpr size_t SIZE = 1;
|
||||||
|
|
|
@ -114,14 +114,14 @@ namespace MultiArrayHelper
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class MExt<void>
|
class MExt<None>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
size_t mExt = 0u;
|
size_t mExt = 0u;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static constexpr size_t NUM = 0;
|
static constexpr size_t NUM = 0;
|
||||||
static constexpr size_t SIZE = NUM + 1;
|
static constexpr size_t SIZE = NUM + 1;
|
||||||
|
|
||||||
|
@ -226,45 +226,45 @@ namespace MultiArrayHelper
|
||||||
|
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
inline MExt<void>::MExt(size_t ext) : mExt(ext) {}
|
inline MExt<None>::MExt(size_t ext) : mExt(ext) {}
|
||||||
|
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
template <class Z>
|
template <class Z>
|
||||||
inline MExt<void>::MExt(size_t y, const Z& z) :
|
inline MExt<None>::MExt(size_t y, const Z& z) :
|
||||||
mExt(z.val()) {}
|
mExt(z.val()) {}
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
template <class Y, class Z>
|
template <class Y, class Z>
|
||||||
inline MExt<void>::MExt(const Y& y, const Z& z) :
|
inline MExt<None>::MExt(const Y& y, const Z& z) :
|
||||||
mExt(y.val()) {}
|
mExt(y.val()) {}
|
||||||
|
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
inline MExt<void>::MExt(const std::array<size_t,N>& arr) :
|
inline MExt<None>::MExt(const std::array<size_t,N>& arr) :
|
||||||
mExt(std::get<NUM>(arr)) {}
|
mExt(std::get<NUM>(arr)) {}
|
||||||
|
|
||||||
template <class Y>
|
template <class Y>
|
||||||
inline MExt<void>::MExt(const MExt<Y>& y) :
|
inline MExt<None>::MExt(const MExt<Y>& y) :
|
||||||
mExt(y.val()) {}
|
mExt(y.val()) {}
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
inline const size_t& MExt<void>::val() const
|
inline const size_t& MExt<None>::val() const
|
||||||
{
|
{
|
||||||
return mExt;
|
return mExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
inline MExt<void> MExt<void>::operator+(const MExt<void>& in) const
|
inline MExt<None> MExt<None>::operator+(const MExt<None>& in) const
|
||||||
{
|
{
|
||||||
return MExt<void>(mExt + in.val());
|
return MExt<None>(mExt + in.val());
|
||||||
}
|
}
|
||||||
|
|
||||||
//template <>
|
//template <>
|
||||||
inline MExt<void> MExt<void>::operator*(size_t in) const
|
inline MExt<None> MExt<None>::operator*(size_t in) const
|
||||||
{
|
{
|
||||||
return MExt<void>(mExt * in);
|
return MExt<None>(mExt * in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace MultiArrayHelper
|
||||||
ExtT(const ExtType& in) : mExt(in) {}
|
ExtT(const ExtType& in) : mExt(in) {}
|
||||||
|
|
||||||
virtual size_t size() const override final { return sizeof(ExtType)/sizeof(size_t); }
|
virtual size_t size() const override final { return sizeof(ExtType)/sizeof(size_t); }
|
||||||
|
//virtual size_t size() const override final { return ExtType::MExtSize(); }
|
||||||
//virtual size_t rootSteps() const override final;
|
//virtual size_t rootSteps() const override final;
|
||||||
const ExtType& ext() const { return mExt; }
|
const ExtType& ext() const { return mExt; }
|
||||||
|
|
||||||
|
@ -87,7 +88,7 @@ namespace MultiArrayHelper
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline MExt<void> mkExt(size_t s) { return MExt<void>(s); }
|
inline MExt<None> mkExt(size_t s) { return MExt<None>(s); }
|
||||||
|
|
||||||
class ExpressionBase
|
class ExpressionBase
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue