fix max() issue in map range; TODO: remove debug tokens

This commit is contained in:
Christian Zimmermann 2018-09-18 22:52:55 +02:00
parent 8e5e5af924
commit 46e5218167
4 changed files with 9 additions and 1 deletions

View file

@ -320,7 +320,9 @@ namespace MultiArrayTools
constexpr size_t NEXT = Op::SIZE; constexpr size_t NEXT = Op::SIZE;
const ExtType nxpos = last; const ExtType nxpos = last;
const size_t pos = mIndPtr->posAt( mOp.get( nxpos ) ); const size_t pos = mIndPtr->posAt( mOp.get( nxpos ) );
//VCHECK(pos);
const ExtType npos = last + mExt*pos; const ExtType npos = last + mExt*pos;
//VCHECK(npos.next().next().val());
const size_t mnpos = PosForward<ForType::DEFAULT>::valuex(mlast, mStep, pos); const size_t mnpos = PosForward<ForType::DEFAULT>::valuex(mlast, mStep, pos);
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ) ); mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ) );
} }
@ -709,7 +711,8 @@ namespace MultiArrayTools
template <class MapF, class... Ranges> template <class MapF, class... Ranges>
size_t MapRange<MapF,Ranges...>::size() const size_t MapRange<MapF,Ranges...>::size() const
{ {
return RPackNum<sizeof...(Ranges)-1>::getSize(mSpace); return mOutRange->size();
//return RPackNum<sizeof...(Ranges)-1>::getSize(mSpace);
} }
template <class MapF, class... Ranges> template <class MapF, class... Ranges>

View file

@ -631,6 +631,7 @@ namespace MultiArrayTools
template <typename T, class OpClass, class... Ranges> template <typename T, class OpClass, class... Ranges>
void OperationMaster<T,OpClass,Ranges...>::performAssignment(std::intptr_t blockIndexNum) void OperationMaster<T,OpClass,Ranges...>::performAssignment(std::intptr_t blockIndexNum)
{ {
CHECK;
AssignmentExpr ae(*this, mSecond); // Expression to be executed within loop AssignmentExpr ae(*this, mSecond); // Expression to be executed within loop
const auto loop = mSecond.template loop<decltype(mIndex.ifor(1,ae))>( mIndex.ifor(1,ae) ); const auto loop = mSecond.template loop<decltype(mIndex.ifor(1,ae))>( mIndex.ifor(1,ae) );
// hidden Loops outside ! -> auto vectorizable // hidden Loops outside ! -> auto vectorizable

View file

@ -145,6 +145,7 @@ namespace MultiArrayTools
mRangePtr = in.mRangePtr; mRangePtr = in.mRangePtr;
mPos = in.mPos; mPos = in.mPos;
mMax = in.mMax; mMax = in.mMax;
return *this;
} }
template <class I, typename MetaType> template <class I, typename MetaType>
@ -153,6 +154,7 @@ namespace MultiArrayTools
mRangePtr = in.mRangePtr; mRangePtr = in.mRangePtr;
mPos = in.mPos; mPos = in.mPos;
mMax = in.mMax; mMax = in.mMax;
return *this;
} }
template <class I, typename MetaType> template <class I, typename MetaType>

View file

@ -188,6 +188,7 @@ namespace MultiArrayHelper
ExtType last) const ExtType last) const
{ {
typedef typename IndexClass::RangeType RangeType; typedef typename IndexClass::RangeType RangeType;
if(mlast == static_cast<size_t>( -1 ) ) { CHECK; }
for(size_t pos = 0u; pos != ForBound<RangeType::ISSTATIC>::template bound<RangeType::SIZE>(mMax); ++pos){ for(size_t pos = 0u; pos != ForBound<RangeType::ISSTATIC>::template bound<RangeType::SIZE>(mMax); ++pos){
//for(size_t pos = mSPos; pos != mMax; ++pos){ //for(size_t pos = mSPos; pos != mMax; ++pos){
//const size_t mnpos = PosForward<FT>::value(mlast, mMax, pos); //const size_t mnpos = PosForward<FT>::value(mlast, mMax, pos);
@ -200,6 +201,7 @@ namespace MultiArrayHelper
template <class IndexClass, class Expr, ForType FT> template <class IndexClass, class Expr, ForType FT>
inline void For<IndexClass,Expr,FT>::operator()(size_t mlast) const inline void For<IndexClass,Expr,FT>::operator()(size_t mlast) const
{ {
if(mlast == static_cast<size_t>( -1 ) ) { CHECK; }
typedef typename IndexClass::RangeType RangeType; typedef typename IndexClass::RangeType RangeType;
const ExtType last; const ExtType last;
for(size_t pos = 0u; pos != ForBound<RangeType::ISSTATIC>::template bound<RangeType::SIZE>(mMax); ++pos){ for(size_t pos = 0u; pos != ForBound<RangeType::ISSTATIC>::template bound<RangeType::SIZE>(mMax); ++pos){